diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/BluetoothAdapter.cpp | 2 | ||||
-rw-r--r-- | src/BluetoothDevice.cpp | 2 | ||||
-rw-r--r-- | src/BluetoothEvent.cpp | 2 | ||||
-rw-r--r-- | src/BluetoothGattCharacteristic.cpp | 2 | ||||
-rw-r--r-- | src/BluetoothGattDescriptor.cpp | 2 | ||||
-rw-r--r-- | src/BluetoothGattService.cpp | 2 | ||||
-rw-r--r-- | src/BluetoothManager.cpp | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 19 | ||||
-rw-r--r-- | src/generated-code.c | 14272 |
9 files changed, 24 insertions, 14281 deletions
diff --git a/src/BluetoothAdapter.cpp b/src/BluetoothAdapter.cpp index 74f2c38..a5658b3 100644 --- a/src/BluetoothAdapter.cpp +++ b/src/BluetoothAdapter.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "tinyb_utils.hpp" #include "BluetoothNotificationHandler.hpp" #include "BluetoothAdapter.hpp" diff --git a/src/BluetoothDevice.cpp b/src/BluetoothDevice.cpp index 9f3500a..b1539bb 100644 --- a/src/BluetoothDevice.cpp +++ b/src/BluetoothDevice.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "tinyb_utils.hpp" #include "BluetoothNotificationHandler.hpp" #include "BluetoothDevice.hpp" diff --git a/src/BluetoothEvent.cpp b/src/BluetoothEvent.cpp index c0aa765..10558ed 100644 --- a/src/BluetoothEvent.cpp +++ b/src/BluetoothEvent.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "BluetoothEvent.hpp" #include "BluetoothManager.hpp" diff --git a/src/BluetoothGattCharacteristic.cpp b/src/BluetoothGattCharacteristic.cpp index fec6d2f..cf0421e 100644 --- a/src/BluetoothGattCharacteristic.cpp +++ b/src/BluetoothGattCharacteristic.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "tinyb_utils.hpp" #include "BluetoothNotificationHandler.hpp" #include "BluetoothGattCharacteristic.hpp" diff --git a/src/BluetoothGattDescriptor.cpp b/src/BluetoothGattDescriptor.cpp index 409e249..5ba4d47 100644 --- a/src/BluetoothGattDescriptor.cpp +++ b/src/BluetoothGattDescriptor.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "tinyb_utils.hpp" #include "BluetoothNotificationHandler.hpp" #include "BluetoothGattDescriptor.hpp" diff --git a/src/BluetoothGattService.cpp b/src/BluetoothGattService.cpp index 23cb480..4bf63e2 100644 --- a/src/BluetoothGattService.cpp +++ b/src/BluetoothGattService.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "tinyb_utils.hpp" #include "BluetoothGattService.hpp" #include "BluetoothGattCharacteristic.hpp" diff --git a/src/BluetoothManager.cpp b/src/BluetoothManager.cpp index 9363617..19d510a 100644 --- a/src/BluetoothManager.cpp +++ b/src/BluetoothManager.cpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "generated-code.h" +#include "orgbluez-dbus.h" #include "BluetoothManager.hpp" #include "BluetoothAdapter.hpp" #include "BluetoothDevice.hpp" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 238549e..201d8ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,7 @@ include_directories( ${GLIB2_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIO-UNIX_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} ) set (tinyb_LIB_SRCS @@ -22,15 +23,29 @@ set (tinyb_LIB_SRCS ${PROJECT_SOURCE_DIR}/src/BluetoothGattDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothUUID.cpp ${PROJECT_SOURCE_DIR}/src/tinyb_utils.cpp - ${PROJECT_SOURCE_DIR}/src/generated-code.c -# autogenerated version file +# autogenerated files ${CMAKE_CURRENT_BINARY_DIR}/version.c + ${CMAKE_CURRENT_BINARY_DIR}/orgbluez-dbus.c ) set (tinyb_LIB_GLOB_HEADERS ${PROJECT_SOURCE_DIR}/api/tinyb.hpp ) +find_program(GDBUS_CODEGEN NAMES gdbus-codegen) +if (NOT GDBUS_CODEGEN) + message(FATAL_ERROR "gdbus-codegen not found") +else () + message(STATUS "gdbus-codegen found") +endif () + +add_custom_command(OUTPUT orgbluez-dbus.c orgbluez-dbus.h + COMMAND ${GDBUS_CODEGEN} + --interface-prefix org.bluez + --generate-c-code orgbluez-dbus + --c-generate-object-manager ${PROJECT_SOURCE_DIR}/src/org.bluez.xml + COMMENT "Generating dbus code from org.bluez.xml") + add_library (tinyb SHARED ${tinyb_LIB_SRCS}) target_link_libraries ( tinyb diff --git a/src/generated-code.c b/src/generated-code.c deleted file mode 100644 index ad14d09..0000000 --- a/src/generated-code.c +++ /dev/null @@ -1,14272 +0,0 @@ -/* - * Generated by gdbus-codegen 2.48.2. DO NOT EDIT. - * - * The license of this code is the same as for the source it was derived from. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "generated-code.h" - -#include <string.h> -#ifdef G_OS_UNIX -# include <gio/gunixfdlist.h> -#endif - -typedef struct -{ - GDBusArgInfo parent_struct; - gboolean use_gvariant; -} _ExtendedGDBusArgInfo; - -typedef struct -{ - GDBusMethodInfo parent_struct; - const gchar *signal_name; - gboolean pass_fdlist; -} _ExtendedGDBusMethodInfo; - -typedef struct -{ - GDBusSignalInfo parent_struct; - const gchar *signal_name; -} _ExtendedGDBusSignalInfo; - -typedef struct -{ - GDBusPropertyInfo parent_struct; - const gchar *hyphen_name; - gboolean use_gvariant; -} _ExtendedGDBusPropertyInfo; - -typedef struct -{ - GDBusInterfaceInfo parent_struct; - const gchar *hyphen_name; -} _ExtendedGDBusInterfaceInfo; - -typedef struct -{ - const _ExtendedGDBusPropertyInfo *info; - guint prop_id; - GValue orig_value; /* the value before the change */ -} ChangedProperty; - -static void -_changed_property_free (ChangedProperty *data) -{ - g_value_unset (&data->orig_value); - g_free (data); -} - -static gboolean -_g_strv_equal0 (gchar **a, gchar **b) -{ - gboolean ret = FALSE; - guint n; - if (a == NULL && b == NULL) - { - ret = TRUE; - goto out; - } - if (a == NULL || b == NULL) - goto out; - if (g_strv_length (a) != g_strv_length (b)) - goto out; - for (n = 0; a[n] != NULL; n++) - if (g_strcmp0 (a[n], b[n]) != 0) - goto out; - ret = TRUE; -out: - return ret; -} - -static gboolean -_g_variant_equal0 (GVariant *a, GVariant *b) -{ - gboolean ret = FALSE; - if (a == NULL && b == NULL) - { - ret = TRUE; - goto out; - } - if (a == NULL || b == NULL) - goto out; - ret = g_variant_equal (a, b); -out: - return ret; -} - -G_GNUC_UNUSED static gboolean -_g_value_equal (const GValue *a, const GValue *b) -{ - gboolean ret = FALSE; - g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); - switch (G_VALUE_TYPE (a)) - { - case G_TYPE_BOOLEAN: - ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); - break; - case G_TYPE_UCHAR: - ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); - break; - case G_TYPE_INT: - ret = (g_value_get_int (a) == g_value_get_int (b)); - break; - case G_TYPE_UINT: - ret = (g_value_get_uint (a) == g_value_get_uint (b)); - break; - case G_TYPE_INT64: - ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); - break; - case G_TYPE_UINT64: - ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); - break; - case G_TYPE_DOUBLE: - { - /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ - gdouble da = g_value_get_double (a); - gdouble db = g_value_get_double (b); - ret = memcmp (&da, &db, sizeof (gdouble)) == 0; - } - break; - case G_TYPE_STRING: - ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); - break; - case G_TYPE_VARIANT: - ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); - break; - default: - if (G_VALUE_TYPE (a) == G_TYPE_STRV) - ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); - else - g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); - break; - } - return ret; -} - -/* ------------------------------------------------------------------------ - * Code for interface org.bluez.Adapter1 - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:Adapter1 - * @title: Adapter1 - * @short_description: Generated C code for the org.bluez.Adapter1 D-Bus interface - * - * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> D-Bus interface in C. - */ - -/* ---- Introspection data for org.bluez.Adapter1 ---- */ - -static const _ExtendedGDBusMethodInfo _adapter1_method_info_start_discovery = -{ - { - -1, - (gchar *) "StartDiscovery", - NULL, - NULL, - NULL - }, - "handle-start-discovery", - FALSE -}; - -static const _ExtendedGDBusMethodInfo _adapter1_method_info_stop_discovery = -{ - { - -1, - (gchar *) "StopDiscovery", - NULL, - NULL, - NULL - }, - "handle-stop-discovery", - FALSE -}; - -static const _ExtendedGDBusArgInfo _adapter1_method_info_remove_device_IN_ARG_device = -{ - { - -1, - (gchar *) "device", - (gchar *) "o", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _adapter1_method_info_remove_device_IN_ARG_pointers[] = -{ - &_adapter1_method_info_remove_device_IN_ARG_device, - NULL -}; - -static const _ExtendedGDBusMethodInfo _adapter1_method_info_remove_device = -{ - { - -1, - (gchar *) "RemoveDevice", - (GDBusArgInfo **) &_adapter1_method_info_remove_device_IN_ARG_pointers, - NULL, - NULL - }, - "handle-remove-device", - FALSE -}; - -static const _ExtendedGDBusMethodInfo * const _adapter1_method_info_pointers[] = -{ - &_adapter1_method_info_start_discovery, - &_adapter1_method_info_stop_discovery, - &_adapter1_method_info_remove_device, - NULL -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_address = -{ - { - -1, - (gchar *) "Address", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "address", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_name = -{ - { - -1, - (gchar *) "Name", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "name", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_alias = -{ - { - -1, - (gchar *) "Alias", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "alias", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_class = -{ - { - -1, - (gchar *) "Class", - (gchar *) "u", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "class", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_powered = -{ - { - -1, - (gchar *) "Powered", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "powered", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_discoverable = -{ - { - -1, - (gchar *) "Discoverable", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "discoverable", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_discoverable_timeout = -{ - { - -1, - (gchar *) "DiscoverableTimeout", - (gchar *) "u", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "discoverable-timeout", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_pairable = -{ - { - -1, - (gchar *) "Pairable", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "pairable", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_pairable_timeout = -{ - { - -1, - (gchar *) "PairableTimeout", - (gchar *) "u", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "pairable-timeout", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_discovering = -{ - { - -1, - (gchar *) "Discovering", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "discovering", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_uuids = -{ - { - -1, - (gchar *) "UUIDs", - (gchar *) "as", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "uuids", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _adapter1_property_info_modalias = -{ - { - -1, - (gchar *) "Modalias", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "modalias", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo * const _adapter1_property_info_pointers[] = -{ - &_adapter1_property_info_address, - &_adapter1_property_info_name, - &_adapter1_property_info_alias, - &_adapter1_property_info_class, - &_adapter1_property_info_powered, - &_adapter1_property_info_discoverable, - &_adapter1_property_info_discoverable_timeout, - &_adapter1_property_info_pairable, - &_adapter1_property_info_pairable_timeout, - &_adapter1_property_info_discovering, - &_adapter1_property_info_uuids, - &_adapter1_property_info_modalias, - NULL -}; - -static const _ExtendedGDBusInterfaceInfo _adapter1_interface_info = -{ - { - -1, - (gchar *) "org.bluez.Adapter1", - (GDBusMethodInfo **) &_adapter1_method_info_pointers, - NULL, - (GDBusPropertyInfo **) &_adapter1_property_info_pointers, - NULL - }, - "adapter1", -}; - - -/** - * adapter1_interface_info: - * - * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> D-Bus interface. - * - * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. - */ -GDBusInterfaceInfo * -adapter1_interface_info (void) -{ - return (GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct; -} - -/** - * adapter1_override_properties: - * @klass: The class structure for a #GObject<!-- -->-derived class. - * @property_id_begin: The property id to assign to the first overridden property. - * - * Overrides all #GObject properties in the #Adapter1 interface for a concrete class. - * The properties are overridden in the order they are defined. - * - * Returns: The last property id. - */ -guint -adapter1_override_properties (GObjectClass *klass, guint property_id_begin) -{ - g_object_class_override_property (klass, property_id_begin++, "address"); - g_object_class_override_property (klass, property_id_begin++, "name"); - g_object_class_override_property (klass, property_id_begin++, "alias"); - g_object_class_override_property (klass, property_id_begin++, "class"); - g_object_class_override_property (klass, property_id_begin++, "powered"); - g_object_class_override_property (klass, property_id_begin++, "discoverable"); - g_object_class_override_property (klass, property_id_begin++, "discoverable-timeout"); - g_object_class_override_property (klass, property_id_begin++, "pairable"); - g_object_class_override_property (klass, property_id_begin++, "pairable-timeout"); - g_object_class_override_property (klass, property_id_begin++, "discovering"); - g_object_class_override_property (klass, property_id_begin++, "uuids"); - g_object_class_override_property (klass, property_id_begin++, "modalias"); - return property_id_begin - 1; -} - - - -/** - * Adapter1: - * - * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. - */ - -/** - * Adapter1Iface: - * @parent_iface: The parent interface. - * @handle_remove_device: Handler for the #Adapter1::handle-remove-device signal. - * @handle_start_discovery: Handler for the #Adapter1::handle-start-discovery signal. - * @handle_stop_discovery: Handler for the #Adapter1::handle-stop-discovery signal. - * @get_address: Getter for the #Adapter1:address property. - * @get_alias: Getter for the #Adapter1:alias property. - * @get_class: Getter for the #Adapter1:class property. - * @get_discoverable: Getter for the #Adapter1:discoverable property. - * @get_discoverable_timeout: Getter for the #Adapter1:discoverable-timeout property. - * @get_discovering: Getter for the #Adapter1:discovering property. - * @get_modalias: Getter for the #Adapter1:modalias property. - * @get_name: Getter for the #Adapter1:name property. - * @get_pairable: Getter for the #Adapter1:pairable property. - * @get_pairable_timeout: Getter for the #Adapter1:pairable-timeout property. - * @get_powered: Getter for the #Adapter1:powered property. - * @get_uuids: Getter for the #Adapter1:uuids property. - * - * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. - */ - -typedef Adapter1Iface Adapter1Interface; -G_DEFINE_INTERFACE (Adapter1, adapter1, G_TYPE_OBJECT); - -static void -adapter1_default_init (Adapter1Iface *iface) -{ - /* GObject signals for incoming D-Bus method calls: */ - /** - * Adapter1::handle-start-discovery: - * @object: A #Adapter1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method. - * - * 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 adapter1_complete_start_discovery() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-start-discovery", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Adapter1Iface, handle_start_discovery), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /** - * Adapter1::handle-stop-discovery: - * @object: A #Adapter1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method. - * - * 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 adapter1_complete_stop_discovery() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-stop-discovery", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Adapter1Iface, handle_stop_discovery), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /** - * Adapter1::handle-remove-device: - * @object: A #Adapter1. - * @invocation: A #GDBusMethodInvocation. - * @arg_device: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method. - * - * 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 adapter1_complete_remove_device() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-remove-device", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Adapter1Iface, handle_remove_device), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); - - /* GObject properties for D-Bus properties: */ - /** - * Adapter1:address: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("address", "Address", "Address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:name: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:alias: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("alias", "Alias", "Alias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:class: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Class">"Class"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_uint ("class", "Class", "Class", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:powered: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Powered">"Powered"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("powered", "Powered", "Powered", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:discoverable: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Discoverable">"Discoverable"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("discoverable", "Discoverable", "Discoverable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:discoverable-timeout: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.DiscoverableTimeout">"DiscoverableTimeout"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_uint ("discoverable-timeout", "DiscoverableTimeout", "DiscoverableTimeout", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:pairable: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Pairable">"Pairable"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("pairable", "Pairable", "Pairable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:pairable-timeout: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.PairableTimeout">"PairableTimeout"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_uint ("pairable-timeout", "PairableTimeout", "PairableTimeout", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:discovering: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Discovering">"Discovering"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("discovering", "Discovering", "Discovering", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:uuids: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("uuids", "UUIDs", "UUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Adapter1:modalias: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("modalias", "Modalias", "Modalias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -/** - * adapter1_get_address: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_address() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -adapter1_get_address (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_address (object); -} - -/** - * adapter1_dup_address: (skip) - * @object: A #Adapter1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -adapter1_dup_address (Adapter1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "address", &value, NULL); - return value; -} - -/** - * adapter1_set_address: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -adapter1_set_address (Adapter1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "address", value, NULL); -} - -/** - * adapter1_get_name: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_name() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -adapter1_get_name (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_name (object); -} - -/** - * adapter1_dup_name: (skip) - * @object: A #Adapter1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -adapter1_dup_name (Adapter1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "name", &value, NULL); - return value; -} - -/** - * adapter1_set_name: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -adapter1_set_name (Adapter1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "name", value, NULL); -} - -/** - * adapter1_get_alias: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_alias() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -adapter1_get_alias (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_alias (object); -} - -/** - * adapter1_dup_alias: (skip) - * @object: A #Adapter1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -adapter1_dup_alias (Adapter1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "alias", &value, NULL); - return value; -} - -/** - * adapter1_set_alias: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -adapter1_set_alias (Adapter1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "alias", value, NULL); -} - -/** - * adapter1_get_class: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Class">"Class"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -guint -adapter1_get_class (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_class (object); -} - -/** - * adapter1_set_class: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Class">"Class"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -adapter1_set_class (Adapter1 *object, guint value) -{ - g_object_set (G_OBJECT (object), "class", value, NULL); -} - -/** - * adapter1_get_powered: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Powered">"Powered"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -adapter1_get_powered (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_powered (object); -} - -/** - * adapter1_set_powered: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Powered">"Powered"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -adapter1_set_powered (Adapter1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "powered", value, NULL); -} - -/** - * adapter1_get_discoverable: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Discoverable">"Discoverable"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -adapter1_get_discoverable (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_discoverable (object); -} - -/** - * adapter1_set_discoverable: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Discoverable">"Discoverable"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -adapter1_set_discoverable (Adapter1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "discoverable", value, NULL); -} - -/** - * adapter1_get_discoverable_timeout: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.DiscoverableTimeout">"DiscoverableTimeout"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -guint -adapter1_get_discoverable_timeout (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_discoverable_timeout (object); -} - -/** - * adapter1_set_discoverable_timeout: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.DiscoverableTimeout">"DiscoverableTimeout"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -adapter1_set_discoverable_timeout (Adapter1 *object, guint value) -{ - g_object_set (G_OBJECT (object), "discoverable-timeout", value, NULL); -} - -/** - * adapter1_get_pairable: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Pairable">"Pairable"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -adapter1_get_pairable (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_pairable (object); -} - -/** - * adapter1_set_pairable: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Pairable">"Pairable"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -adapter1_set_pairable (Adapter1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "pairable", value, NULL); -} - -/** - * adapter1_get_pairable_timeout: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.PairableTimeout">"PairableTimeout"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -guint -adapter1_get_pairable_timeout (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_pairable_timeout (object); -} - -/** - * adapter1_set_pairable_timeout: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.PairableTimeout">"PairableTimeout"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -adapter1_set_pairable_timeout (Adapter1 *object, guint value) -{ - g_object_set (G_OBJECT (object), "pairable-timeout", value, NULL); -} - -/** - * adapter1_get_discovering: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Discovering">"Discovering"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -adapter1_get_discovering (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_discovering (object); -} - -/** - * adapter1_set_discovering: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Discovering">"Discovering"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -adapter1_set_discovering (Adapter1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "discovering", value, NULL); -} - -/** - * adapter1_get_uuids: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_uuids() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -adapter1_get_uuids (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_uuids (object); -} - -/** - * adapter1_dup_uuids: (skip) - * @object: A #Adapter1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -adapter1_dup_uuids (Adapter1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "uuids", &value, NULL); - return value; -} - -/** - * adapter1_set_uuids: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -adapter1_set_uuids (Adapter1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "uuids", value, NULL); -} - -/** - * adapter1_get_modalias: (skip) - * @object: A #Adapter1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_modalias() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -adapter1_get_modalias (Adapter1 *object) -{ - return ADAPTER1_GET_IFACE (object)->get_modalias (object); -} - -/** - * adapter1_dup_modalias: (skip) - * @object: A #Adapter1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -adapter1_dup_modalias (Adapter1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "modalias", &value, NULL); - return value; -} - -/** - * adapter1_set_modalias: (skip) - * @object: A #Adapter1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -adapter1_set_modalias (Adapter1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "modalias", value, NULL); -} - -/** - * adapter1_call_start_discovery: - * @proxy: A #Adapter1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method on @proxy. - * 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. - * You can then call adapter1_call_start_discovery_finish() to get the result of the operation. - * - * See adapter1_call_start_discovery_sync() for the synchronous, blocking version of this method. - */ -void -adapter1_call_start_discovery ( - Adapter1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "StartDiscovery", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * adapter1_call_start_discovery_finish: - * @proxy: A #Adapter1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_call_start_discovery(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with adapter1_call_start_discovery(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -adapter1_call_start_discovery_finish ( - Adapter1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * adapter1_call_start_discovery_sync: - * @proxy: A #Adapter1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See adapter1_call_start_discovery() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -adapter1_call_start_discovery_sync ( - Adapter1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "StartDiscovery", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * adapter1_call_stop_discovery: - * @proxy: A #Adapter1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method on @proxy. - * 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. - * You can then call adapter1_call_stop_discovery_finish() to get the result of the operation. - * - * See adapter1_call_stop_discovery_sync() for the synchronous, blocking version of this method. - */ -void -adapter1_call_stop_discovery ( - Adapter1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "StopDiscovery", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * adapter1_call_stop_discovery_finish: - * @proxy: A #Adapter1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_call_stop_discovery(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with adapter1_call_stop_discovery(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -adapter1_call_stop_discovery_finish ( - Adapter1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * adapter1_call_stop_discovery_sync: - * @proxy: A #Adapter1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See adapter1_call_stop_discovery() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -adapter1_call_stop_discovery_sync ( - Adapter1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "StopDiscovery", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * adapter1_call_remove_device: - * @proxy: A #Adapter1Proxy. - * @arg_device: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method on @proxy. - * 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. - * You can then call adapter1_call_remove_device_finish() to get the result of the operation. - * - * See adapter1_call_remove_device_sync() for the synchronous, blocking version of this method. - */ -void -adapter1_call_remove_device ( - Adapter1 *proxy, - const gchar *arg_device, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "RemoveDevice", - g_variant_new ("(o)", - arg_device), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * adapter1_call_remove_device_finish: - * @proxy: A #Adapter1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_call_remove_device(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with adapter1_call_remove_device(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -adapter1_call_remove_device_finish ( - Adapter1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * adapter1_call_remove_device_sync: - * @proxy: A #Adapter1Proxy. - * @arg_device: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See adapter1_call_remove_device() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -adapter1_call_remove_device_sync ( - Adapter1 *proxy, - const gchar *arg_device, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "RemoveDevice", - g_variant_new ("(o)", - arg_device), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * adapter1_complete_start_discovery: - * @object: A #Adapter1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -adapter1_complete_start_discovery ( - Adapter1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * adapter1_complete_stop_discovery: - * @object: A #Adapter1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -adapter1_complete_stop_discovery ( - Adapter1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * adapter1_complete_remove_device: - * @object: A #Adapter1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -adapter1_complete_remove_device ( - Adapter1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/* ------------------------------------------------------------------------ */ - -/** - * Adapter1Proxy: - * - * The #Adapter1Proxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * Adapter1ProxyClass: - * @parent_class: The parent class. - * - * Class structure for #Adapter1Proxy. - */ - -struct _Adapter1ProxyPrivate -{ - GData *qdata; -}; - -static void adapter1_proxy_iface_init (Adapter1Iface *iface); - -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (Adapter1Proxy, adapter1_proxy, G_TYPE_DBUS_PROXY, - G_ADD_PRIVATE (Adapter1Proxy) - G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_proxy_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (Adapter1Proxy, adapter1_proxy, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_proxy_iface_init)); - -#endif -static void -adapter1_proxy_finalize (GObject *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - g_datalist_clear (&proxy->priv->qdata); - G_OBJECT_CLASS (adapter1_proxy_parent_class)->finalize (object); -} - -static void -adapter1_proxy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 12); - info = _adapter1_property_info_pointers[prop_id - 1]; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); - if (info->use_gvariant) - { - g_value_set_variant (value, variant); - } - else - { - if (variant != NULL) - g_dbus_gvariant_to_gvalue (variant, value); - } - if (variant != NULL) - g_variant_unref (variant); -} - -static void -adapter1_proxy_set_property_cb (GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - const _ExtendedGDBusPropertyInfo *info = user_data; - GError *error; - GVariant *_ret; - error = NULL; - _ret = g_dbus_proxy_call_finish (proxy, res, &error); - if (!_ret) - { - g_warning ("Error setting property '%s' on interface org.bluez.Adapter1: %s (%s, %d)", - info->parent_struct.name, - error->message, g_quark_to_string (error->domain), error->code); - g_error_free (error); - } - else - { - g_variant_unref (_ret); - } -} - -static void -adapter1_proxy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 12); - info = _adapter1_property_info_pointers[prop_id - 1]; - variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_dbus_proxy_call (G_DBUS_PROXY (object), - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", "org.bluez.Adapter1", info->parent_struct.name, variant), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, (GAsyncReadyCallback) adapter1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); - g_variant_unref (variant); -} - -static void -adapter1_proxy_g_signal (GDBusProxy *proxy, - const gchar *sender_name G_GNUC_UNUSED, - const gchar *signal_name, - GVariant *parameters) -{ - _ExtendedGDBusSignalInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint n; - guint signal_id; - info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, signal_name); - if (info == NULL) - return; - num_params = g_variant_n_children (parameters); - paramv = g_new0 (GValue, num_params + 1); - g_value_init (¶mv[0], TYPE_ADAPTER1); - g_value_set_object (¶mv[0], proxy); - g_variant_iter_init (&iter, parameters); - n = 1; - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_ADAPTER1); - g_signal_emitv (paramv, signal_id, 0, NULL); - for (n = 0; n < num_params + 1; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static void -adapter1_proxy_g_properties_changed (GDBusProxy *_proxy, - GVariant *changed_properties, - const gchar *const *invalidated_properties) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (_proxy); - guint n; - const gchar *key; - GVariantIter *iter; - _ExtendedGDBusPropertyInfo *info; - g_variant_get (changed_properties, "a{sv}", &iter); - while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, key); - g_datalist_remove_data (&proxy->priv->qdata, key); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } - g_variant_iter_free (iter); - for (n = 0; invalidated_properties[n] != NULL; n++) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, invalidated_properties[n]); - g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } -} - -static const gchar * -adapter1_proxy_get_address (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Address"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -adapter1_proxy_get_name (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -adapter1_proxy_get_alias (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Alias"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static guint -adapter1_proxy_get_class (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - guint value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Class"); - if (variant != NULL) - { - value = g_variant_get_uint32 (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -adapter1_proxy_get_powered (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Powered"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -adapter1_proxy_get_discoverable (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Discoverable"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static guint -adapter1_proxy_get_discoverable_timeout (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - guint value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DiscoverableTimeout"); - if (variant != NULL) - { - value = g_variant_get_uint32 (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -adapter1_proxy_get_pairable (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Pairable"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static guint -adapter1_proxy_get_pairable_timeout (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - guint value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PairableTimeout"); - if (variant != NULL) - { - value = g_variant_get_uint32 (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -adapter1_proxy_get_discovering (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Discovering"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static const gchar *const * -adapter1_proxy_get_uuids (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - value = g_datalist_get_data (&proxy->priv->qdata, "UUIDs"); - if (value != NULL) - return value; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUIDs"); - if (variant != NULL) - { - value = g_variant_get_strv (variant, NULL); - g_datalist_set_data_full (&proxy->priv->qdata, "UUIDs", (gpointer) value, g_free); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -adapter1_proxy_get_modalias (Adapter1 *object) -{ - Adapter1Proxy *proxy = ADAPTER1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Modalias"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static void -adapter1_proxy_init (Adapter1Proxy *proxy) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - proxy->priv = adapter1_proxy_get_instance_private (proxy); -#else - proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ADAPTER1_PROXY, Adapter1ProxyPrivate); -#endif - - g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), adapter1_interface_info ()); -} - -static void -adapter1_proxy_class_init (Adapter1ProxyClass *klass) -{ - GObjectClass *gobject_class; - GDBusProxyClass *proxy_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = adapter1_proxy_finalize; - gobject_class->get_property = adapter1_proxy_get_property; - gobject_class->set_property = adapter1_proxy_set_property; - - proxy_class = G_DBUS_PROXY_CLASS (klass); - proxy_class->g_signal = adapter1_proxy_g_signal; - proxy_class->g_properties_changed = adapter1_proxy_g_properties_changed; - - adapter1_override_properties (gobject_class, 1); - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (Adapter1ProxyPrivate)); -#endif -} - -static void -adapter1_proxy_iface_init (Adapter1Iface *iface) -{ - iface->get_address = adapter1_proxy_get_address; - iface->get_name = adapter1_proxy_get_name; - iface->get_alias = adapter1_proxy_get_alias; - iface->get_class = adapter1_proxy_get_class; - iface->get_powered = adapter1_proxy_get_powered; - iface->get_discoverable = adapter1_proxy_get_discoverable; - iface->get_discoverable_timeout = adapter1_proxy_get_discoverable_timeout; - iface->get_pairable = adapter1_proxy_get_pairable; - iface->get_pairable_timeout = adapter1_proxy_get_pairable_timeout; - iface->get_discovering = adapter1_proxy_get_discovering; - iface->get_uuids = adapter1_proxy_get_uuids; - iface->get_modalias = adapter1_proxy_get_modalias; -} - -/** - * adapter1_proxy_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. See g_dbus_proxy_new() for more details. - * - * 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. - * You can then call adapter1_proxy_new_finish() to get the result of the operation. - * - * See adapter1_proxy_new_sync() for the synchronous, blocking version of this constructor. - */ -void -adapter1_proxy_new ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_ADAPTER1_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.Adapter1", NULL); -} - -/** - * adapter1_proxy_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_proxy_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with adapter1_proxy_new(). - * - * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Adapter1 * -adapter1_proxy_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return ADAPTER1 (ret); - else - return NULL; -} - -/** - * adapter1_proxy_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. See g_dbus_proxy_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See adapter1_proxy_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Adapter1 * -adapter1_proxy_new_sync ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_ADAPTER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); - if (ret != NULL) - return ADAPTER1 (ret); - else - return NULL; -} - - -/** - * adapter1_proxy_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like adapter1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call adapter1_proxy_new_for_bus_finish() to get the result of the operation. - * - * See adapter1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -adapter1_proxy_new_for_bus ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_ADAPTER1_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.Adapter1", NULL); -} - -/** - * adapter1_proxy_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_proxy_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with adapter1_proxy_new_for_bus(). - * - * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Adapter1 * -adapter1_proxy_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return ADAPTER1 (ret); - else - return NULL; -} - -/** - * adapter1_proxy_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like adapter1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See adapter1_proxy_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Adapter1 * -adapter1_proxy_new_for_bus_sync ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_ADAPTER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); - if (ret != NULL) - return ADAPTER1 (ret); - else - return NULL; -} - - -/* ------------------------------------------------------------------------ */ - -/** - * Adapter1Skeleton: - * - * The #Adapter1Skeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * Adapter1SkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #Adapter1Skeleton. - */ - -struct _Adapter1SkeletonPrivate -{ - GValue *properties; - GList *changed_properties; - GSource *changed_properties_idle_source; - GMainContext *context; - GMutex lock; -}; - -static void -_adapter1_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) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); - _ExtendedGDBusMethodInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint num_extra; - guint n; - guint signal_id; - GValue return_value = G_VALUE_INIT; - info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); - g_assert (info != NULL); - num_params = g_variant_n_children (parameters); - num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); - n = 0; - g_value_init (¶mv[n], TYPE_ADAPTER1); - g_value_set_object (¶mv[n++], skeleton); - g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); - g_value_set_object (¶mv[n++], invocation); - if (info->pass_fdlist) - { -#ifdef G_OS_UNIX - g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); - g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); -#else - g_assert_not_reached (); -#endif - } - g_variant_iter_init (&iter, parameters); - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_ADAPTER1); - g_value_init (&return_value, G_TYPE_BOOLEAN); - g_signal_emitv (paramv, signal_id, 0, &return_value); - if (!g_value_get_boolean (&return_value)) - 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); - g_value_unset (&return_value); - for (n = 0; n < num_params + num_extra; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static GVariant * -_adapter1_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) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - GVariant *ret; - ret = NULL; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - g_value_init (&value, pspec->value_type); - g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); - ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_value_unset (&value); - } - return ret; -} - -static gboolean -_adapter1_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) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - gboolean ret; - ret = FALSE; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - if (info->use_gvariant) - g_value_set_variant (&value, variant); - else - g_dbus_gvariant_to_gvalue (variant, &value); - g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); - g_value_unset (&value); - ret = TRUE; - } - return ret; -} - -static const GDBusInterfaceVTable _adapter1_skeleton_vtable = -{ - _adapter1_skeleton_handle_method_call, - _adapter1_skeleton_handle_get_property, - _adapter1_skeleton_handle_set_property, - {NULL} -}; - -static GDBusInterfaceInfo * -adapter1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return adapter1_interface_info (); -} - -static GDBusInterfaceVTable * -adapter1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return (GDBusInterfaceVTable *) &_adapter1_skeleton_vtable; -} - -static GVariant * -adapter1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (_skeleton); - - GVariantBuilder builder; - guint n; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - if (_adapter1_interface_info.parent_struct.properties == NULL) - goto out; - for (n = 0; _adapter1_interface_info.parent_struct.properties[n] != NULL; n++) - { - GDBusPropertyInfo *info = _adapter1_interface_info.parent_struct.properties[n]; - if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) - { - GVariant *value; - value = _adapter1_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.Adapter1", info->name, NULL, skeleton); - if (value != NULL) - { - g_variant_take_ref (value); - g_variant_builder_add (&builder, "{sv}", info->name, value); - g_variant_unref (value); - } - } - } -out: - return g_variant_builder_end (&builder); -} - -static gboolean _adapter1_emit_changed (gpointer user_data); - -static void -adapter1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (_skeleton); - gboolean emit_changed = FALSE; - - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties_idle_source != NULL) - { - g_source_destroy (skeleton->priv->changed_properties_idle_source); - skeleton->priv->changed_properties_idle_source = NULL; - emit_changed = TRUE; - } - g_mutex_unlock (&skeleton->priv->lock); - - if (emit_changed) - _adapter1_emit_changed (skeleton); -} - -static void adapter1_skeleton_iface_init (Adapter1Iface *iface); -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (Adapter1Skeleton, adapter1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_ADD_PRIVATE (Adapter1Skeleton) - G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_skeleton_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (Adapter1Skeleton, adapter1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_skeleton_iface_init)); - -#endif -static void -adapter1_skeleton_finalize (GObject *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - guint n; - for (n = 0; n < 12; n++) - g_value_unset (&skeleton->priv->properties[n]); - g_free (skeleton->priv->properties); - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - if (skeleton->priv->changed_properties_idle_source != NULL) - g_source_destroy (skeleton->priv->changed_properties_idle_source); - g_main_context_unref (skeleton->priv->context); - g_mutex_clear (&skeleton->priv->lock); - G_OBJECT_CLASS (adapter1_skeleton_parent_class)->finalize (object); -} - -static void -adapter1_skeleton_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 12); - g_mutex_lock (&skeleton->priv->lock); - g_value_copy (&skeleton->priv->properties[prop_id - 1], value); - g_mutex_unlock (&skeleton->priv->lock); -} - -static gboolean -_adapter1_emit_changed (gpointer user_data) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); - GList *l; - GVariantBuilder builder; - GVariantBuilder invalidated_builder; - guint num_changes; - - g_mutex_lock (&skeleton->priv->lock); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); - for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) - { - ChangedProperty *cp = l->data; - GVariant *variant; - const GValue *cur_value; - - cur_value = &skeleton->priv->properties[cp->prop_id - 1]; - if (!_g_value_equal (cur_value, &cp->orig_value)) - { - variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); - g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); - g_variant_unref (variant); - num_changes++; - } - } - if (num_changes > 0) - { - GList *connections, *ll; - GVariant *signal_variant; - signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.Adapter1", - &builder, &invalidated_builder)); - connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); - for (ll = connections; ll != NULL; ll = ll->next) - { - GDBusConnection *connection = ll->data; - - g_dbus_connection_emit_signal (connection, - NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - signal_variant, - NULL); - } - g_variant_unref (signal_variant); - g_list_free_full (connections, g_object_unref); - } - else - { - g_variant_builder_clear (&builder); - g_variant_builder_clear (&invalidated_builder); - } - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - skeleton->priv->changed_properties = NULL; - skeleton->priv->changed_properties_idle_source = NULL; - g_mutex_unlock (&skeleton->priv->lock); - return FALSE; -} - -static void -_adapter1_schedule_emit_changed (Adapter1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) -{ - ChangedProperty *cp; - GList *l; - cp = NULL; - for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) - { - ChangedProperty *i_cp = l->data; - if (i_cp->info == info) - { - cp = i_cp; - break; - } - } - if (cp == NULL) - { - cp = g_new0 (ChangedProperty, 1); - cp->prop_id = prop_id; - cp->info = info; - skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); - g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); - g_value_copy (orig_value, &cp->orig_value); - } -} - -static void -adapter1_skeleton_notify (GObject *object, - GParamSpec *pspec G_GNUC_UNUSED) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties != NULL && - skeleton->priv->changed_properties_idle_source == NULL) - { - skeleton->priv->changed_properties_idle_source = g_idle_source_new (); - g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); - g_source_set_callback (skeleton->priv->changed_properties_idle_source, _adapter1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); - g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _adapter1_emit_changed"); - g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); - g_source_unref (skeleton->priv->changed_properties_idle_source); - } - g_mutex_unlock (&skeleton->priv->lock); -} - -static void -adapter1_skeleton_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 12); - g_mutex_lock (&skeleton->priv->lock); - g_object_freeze_notify (object); - if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) - { - if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) - _adapter1_schedule_emit_changed (skeleton, _adapter1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); - g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); - g_object_notify_by_pspec (object, pspec); - } - g_mutex_unlock (&skeleton->priv->lock); - g_object_thaw_notify (object); -} - -static void -adapter1_skeleton_init (Adapter1Skeleton *skeleton) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - skeleton->priv = adapter1_skeleton_get_instance_private (skeleton); -#else - skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ADAPTER1_SKELETON, Adapter1SkeletonPrivate); -#endif - - g_mutex_init (&skeleton->priv->lock); - skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 12); - g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[3], G_TYPE_UINT); - g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[5], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[6], G_TYPE_UINT); - g_value_init (&skeleton->priv->properties[7], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[8], G_TYPE_UINT); - g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[10], G_TYPE_STRV); - g_value_init (&skeleton->priv->properties[11], G_TYPE_STRING); -} - -static const gchar * -adapter1_skeleton_get_address (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[0])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -adapter1_skeleton_get_name (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[1])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -adapter1_skeleton_get_alias (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[2])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static guint -adapter1_skeleton_get_class (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - guint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_uint (&(skeleton->priv->properties[3])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -adapter1_skeleton_get_powered (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[4])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -adapter1_skeleton_get_discoverable (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[5])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static guint -adapter1_skeleton_get_discoverable_timeout (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - guint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_uint (&(skeleton->priv->properties[6])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -adapter1_skeleton_get_pairable (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[7])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static guint -adapter1_skeleton_get_pairable_timeout (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - guint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_uint (&(skeleton->priv->properties[8])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -adapter1_skeleton_get_discovering (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[9])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -adapter1_skeleton_get_uuids (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[10])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -adapter1_skeleton_get_modalias (Adapter1 *object) -{ - Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[11])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static void -adapter1_skeleton_class_init (Adapter1SkeletonClass *klass) -{ - GObjectClass *gobject_class; - GDBusInterfaceSkeletonClass *skeleton_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = adapter1_skeleton_finalize; - gobject_class->get_property = adapter1_skeleton_get_property; - gobject_class->set_property = adapter1_skeleton_set_property; - gobject_class->notify = adapter1_skeleton_notify; - - - adapter1_override_properties (gobject_class, 1); - - skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); - skeleton_class->get_info = adapter1_skeleton_dbus_interface_get_info; - skeleton_class->get_properties = adapter1_skeleton_dbus_interface_get_properties; - skeleton_class->flush = adapter1_skeleton_dbus_interface_flush; - skeleton_class->get_vtable = adapter1_skeleton_dbus_interface_get_vtable; - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (Adapter1SkeletonPrivate)); -#endif -} - -static void -adapter1_skeleton_iface_init (Adapter1Iface *iface) -{ - iface->get_address = adapter1_skeleton_get_address; - iface->get_name = adapter1_skeleton_get_name; - iface->get_alias = adapter1_skeleton_get_alias; - iface->get_class = adapter1_skeleton_get_class; - iface->get_powered = adapter1_skeleton_get_powered; - iface->get_discoverable = adapter1_skeleton_get_discoverable; - iface->get_discoverable_timeout = adapter1_skeleton_get_discoverable_timeout; - iface->get_pairable = adapter1_skeleton_get_pairable; - iface->get_pairable_timeout = adapter1_skeleton_get_pairable_timeout; - iface->get_discovering = adapter1_skeleton_get_discovering; - iface->get_uuids = adapter1_skeleton_get_uuids; - iface->get_modalias = adapter1_skeleton_get_modalias; -} - -/** - * adapter1_skeleton_new: - * - * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. - * - * Returns: (transfer full) (type Adapter1Skeleton): The skeleton object. - */ -Adapter1 * -adapter1_skeleton_new (void) -{ - return ADAPTER1 (g_object_new (TYPE_ADAPTER1_SKELETON, NULL)); -} - -/* ------------------------------------------------------------------------ - * Code for interface org.bluez.Device1 - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:Device1 - * @title: Device1 - * @short_description: Generated C code for the org.bluez.Device1 D-Bus interface - * - * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> D-Bus interface in C. - */ - -/* ---- Introspection data for org.bluez.Device1 ---- */ - -static const _ExtendedGDBusMethodInfo _device1_method_info_disconnect = -{ - { - -1, - (gchar *) "Disconnect", - NULL, - NULL, - NULL - }, - "handle-disconnect", - FALSE -}; - -static const _ExtendedGDBusMethodInfo _device1_method_info_connect = -{ - { - -1, - (gchar *) "Connect", - NULL, - NULL, - NULL - }, - "handle-connect", - FALSE -}; - -static const _ExtendedGDBusArgInfo _device1_method_info_connect_profile_IN_ARG_UUID = -{ - { - -1, - (gchar *) "UUID", - (gchar *) "s", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _device1_method_info_connect_profile_IN_ARG_pointers[] = -{ - &_device1_method_info_connect_profile_IN_ARG_UUID, - NULL -}; - -static const _ExtendedGDBusMethodInfo _device1_method_info_connect_profile = -{ - { - -1, - (gchar *) "ConnectProfile", - (GDBusArgInfo **) &_device1_method_info_connect_profile_IN_ARG_pointers, - NULL, - NULL - }, - "handle-connect-profile", - FALSE -}; - -static const _ExtendedGDBusArgInfo _device1_method_info_disconnect_profile_IN_ARG_UUID = -{ - { - -1, - (gchar *) "UUID", - (gchar *) "s", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _device1_method_info_disconnect_profile_IN_ARG_pointers[] = -{ - &_device1_method_info_disconnect_profile_IN_ARG_UUID, - NULL -}; - -static const _ExtendedGDBusMethodInfo _device1_method_info_disconnect_profile = -{ - { - -1, - (gchar *) "DisconnectProfile", - (GDBusArgInfo **) &_device1_method_info_disconnect_profile_IN_ARG_pointers, - NULL, - NULL - }, - "handle-disconnect-profile", - FALSE -}; - -static const _ExtendedGDBusMethodInfo _device1_method_info_pair = -{ - { - -1, - (gchar *) "Pair", - NULL, - NULL, - NULL - }, - "handle-pair", - FALSE -}; - -static const _ExtendedGDBusMethodInfo _device1_method_info_cancel_pairing = -{ - { - -1, - (gchar *) "CancelPairing", - NULL, - NULL, - NULL - }, - "handle-cancel-pairing", - FALSE -}; - -static const _ExtendedGDBusMethodInfo * const _device1_method_info_pointers[] = -{ - &_device1_method_info_disconnect, - &_device1_method_info_connect, - &_device1_method_info_connect_profile, - &_device1_method_info_disconnect_profile, - &_device1_method_info_pair, - &_device1_method_info_cancel_pairing, - NULL -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_address = -{ - { - -1, - (gchar *) "Address", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "address", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_name = -{ - { - -1, - (gchar *) "Name", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "name", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_alias = -{ - { - -1, - (gchar *) "Alias", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "alias", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_class = -{ - { - -1, - (gchar *) "Class", - (gchar *) "u", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "class", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_appearance = -{ - { - -1, - (gchar *) "Appearance", - (gchar *) "q", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "appearance", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_icon = -{ - { - -1, - (gchar *) "Icon", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "icon", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_paired = -{ - { - -1, - (gchar *) "Paired", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "paired", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_trusted = -{ - { - -1, - (gchar *) "Trusted", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "trusted", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_blocked = -{ - { - -1, - (gchar *) "Blocked", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, - NULL - }, - "blocked", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_legacy_pairing = -{ - { - -1, - (gchar *) "LegacyPairing", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "legacy-pairing", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_rssi = -{ - { - -1, - (gchar *) "RSSI", - (gchar *) "n", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "rssi", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_connected = -{ - { - -1, - (gchar *) "Connected", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "connected", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_uuids = -{ - { - -1, - (gchar *) "UUIDs", - (gchar *) "as", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "uuids", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_modalias = -{ - { - -1, - (gchar *) "Modalias", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "modalias", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_adapter = -{ - { - -1, - (gchar *) "Adapter", - (gchar *) "o", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "adapter", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_manufacturer_data = -{ - { - -1, - (gchar *) "ManufacturerData", - (gchar *) "a{qv}", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "manufacturer-data", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_service_data = -{ - { - -1, - (gchar *) "ServiceData", - (gchar *) "a{sv}", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "service-data", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_tx_power = -{ - { - -1, - (gchar *) "TxPower", - (gchar *) "n", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "tx-power", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _device1_property_info_services_resolved = -{ - { - -1, - (gchar *) "ServicesResolved", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "services-resolved", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo * const _device1_property_info_pointers[] = -{ - &_device1_property_info_address, - &_device1_property_info_name, - &_device1_property_info_alias, - &_device1_property_info_class, - &_device1_property_info_appearance, - &_device1_property_info_icon, - &_device1_property_info_paired, - &_device1_property_info_trusted, - &_device1_property_info_blocked, - &_device1_property_info_legacy_pairing, - &_device1_property_info_rssi, - &_device1_property_info_connected, - &_device1_property_info_uuids, - &_device1_property_info_modalias, - &_device1_property_info_adapter, - &_device1_property_info_manufacturer_data, - &_device1_property_info_service_data, - &_device1_property_info_tx_power, - &_device1_property_info_services_resolved, - NULL -}; - -static const _ExtendedGDBusInterfaceInfo _device1_interface_info = -{ - { - -1, - (gchar *) "org.bluez.Device1", - (GDBusMethodInfo **) &_device1_method_info_pointers, - NULL, - (GDBusPropertyInfo **) &_device1_property_info_pointers, - NULL - }, - "device1", -}; - - -/** - * device1_interface_info: - * - * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> D-Bus interface. - * - * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. - */ -GDBusInterfaceInfo * -device1_interface_info (void) -{ - return (GDBusInterfaceInfo *) &_device1_interface_info.parent_struct; -} - -/** - * device1_override_properties: - * @klass: The class structure for a #GObject<!-- -->-derived class. - * @property_id_begin: The property id to assign to the first overridden property. - * - * Overrides all #GObject properties in the #Device1 interface for a concrete class. - * The properties are overridden in the order they are defined. - * - * Returns: The last property id. - */ -guint -device1_override_properties (GObjectClass *klass, guint property_id_begin) -{ - g_object_class_override_property (klass, property_id_begin++, "address"); - g_object_class_override_property (klass, property_id_begin++, "name"); - g_object_class_override_property (klass, property_id_begin++, "alias"); - g_object_class_override_property (klass, property_id_begin++, "class"); - g_object_class_override_property (klass, property_id_begin++, "appearance"); - g_object_class_override_property (klass, property_id_begin++, "icon"); - g_object_class_override_property (klass, property_id_begin++, "paired"); - g_object_class_override_property (klass, property_id_begin++, "trusted"); - g_object_class_override_property (klass, property_id_begin++, "blocked"); - g_object_class_override_property (klass, property_id_begin++, "legacy-pairing"); - g_object_class_override_property (klass, property_id_begin++, "rssi"); - g_object_class_override_property (klass, property_id_begin++, "connected"); - g_object_class_override_property (klass, property_id_begin++, "uuids"); - g_object_class_override_property (klass, property_id_begin++, "modalias"); - g_object_class_override_property (klass, property_id_begin++, "adapter"); - g_object_class_override_property (klass, property_id_begin++, "manufacturer-data"); - g_object_class_override_property (klass, property_id_begin++, "service-data"); - g_object_class_override_property (klass, property_id_begin++, "tx-power"); - g_object_class_override_property (klass, property_id_begin++, "services-resolved"); - return property_id_begin - 1; -} - - - -/** - * Device1: - * - * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. - */ - -/** - * Device1Iface: - * @parent_iface: The parent interface. - * @handle_cancel_pairing: Handler for the #Device1::handle-cancel-pairing signal. - * @handle_connect: Handler for the #Device1::handle-connect signal. - * @handle_connect_profile: Handler for the #Device1::handle-connect-profile signal. - * @handle_disconnect: Handler for the #Device1::handle-disconnect signal. - * @handle_disconnect_profile: Handler for the #Device1::handle-disconnect-profile signal. - * @handle_pair: Handler for the #Device1::handle-pair signal. - * @get_adapter: Getter for the #Device1:adapter property. - * @get_address: Getter for the #Device1:address property. - * @get_alias: Getter for the #Device1:alias property. - * @get_appearance: Getter for the #Device1:appearance property. - * @get_blocked: Getter for the #Device1:blocked property. - * @get_class: Getter for the #Device1:class property. - * @get_connected: Getter for the #Device1:connected property. - * @get_icon: Getter for the #Device1:icon property. - * @get_legacy_pairing: Getter for the #Device1:legacy-pairing property. - * @get_manufacturer_data: Getter for the #Device1:manufacturer-data property. - * @get_modalias: Getter for the #Device1:modalias property. - * @get_name: Getter for the #Device1:name property. - * @get_paired: Getter for the #Device1:paired property. - * @get_rssi: Getter for the #Device1:rssi property. - * @get_service_data: Getter for the #Device1:service-data property. - * @get_services_resolved: Getter for the #Device1:services-resolved property. - * @get_trusted: Getter for the #Device1:trusted property. - * @get_tx_power: Getter for the #Device1:tx-power property. - * @get_uuids: Getter for the #Device1:uuids property. - * - * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. - */ - -typedef Device1Iface Device1Interface; -G_DEFINE_INTERFACE (Device1, device1, G_TYPE_OBJECT); - -static void -device1_default_init (Device1Iface *iface) -{ - /* GObject signals for incoming D-Bus method calls: */ - /** - * Device1::handle-disconnect: - * @object: A #Device1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method. - * - * 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 device1_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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-disconnect", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Device1Iface, handle_disconnect), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /** - * Device1::handle-connect: - * @object: A #Device1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method. - * - * 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 device1_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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-connect", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Device1Iface, handle_connect), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /** - * Device1::handle-connect-profile: - * @object: A #Device1. - * @invocation: A #GDBusMethodInvocation. - * @arg_UUID: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method. - * - * 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 device1_complete_connect_profile() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-connect-profile", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Device1Iface, handle_connect_profile), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); - - /** - * Device1::handle-disconnect-profile: - * @object: A #Device1. - * @invocation: A #GDBusMethodInvocation. - * @arg_UUID: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method. - * - * 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 device1_complete_disconnect_profile() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-disconnect-profile", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Device1Iface, handle_disconnect_profile), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); - - /** - * Device1::handle-pair: - * @object: A #Device1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method. - * - * 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 device1_complete_pair() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-pair", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Device1Iface, handle_pair), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /** - * Device1::handle-cancel-pairing: - * @object: A #Device1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method. - * - * 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 device1_complete_cancel_pairing() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-cancel-pairing", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Device1Iface, handle_cancel_pairing), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /* GObject properties for D-Bus properties: */ - /** - * Device1:address: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("address", "Address", "Address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:name: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:alias: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("alias", "Alias", "Alias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:class: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Class">"Class"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_uint ("class", "Class", "Class", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:appearance: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Appearance">"Appearance"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_uint ("appearance", "Appearance", "Appearance", 0, G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:icon: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("icon", "Icon", "Icon", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:paired: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Paired">"Paired"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("paired", "Paired", "Paired", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:trusted: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Trusted">"Trusted"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("trusted", "Trusted", "Trusted", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:blocked: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Blocked">"Blocked"</link>. - * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("blocked", "Blocked", "Blocked", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:legacy-pairing: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.LegacyPairing">"LegacyPairing"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("legacy-pairing", "LegacyPairing", "LegacyPairing", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:rssi: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.RSSI">"RSSI"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_int ("rssi", "RSSI", "RSSI", G_MININT16, G_MAXINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:connected: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Connected">"Connected"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("connected", "Connected", "Connected", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:uuids: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("uuids", "UUIDs", "UUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:modalias: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("modalias", "Modalias", "Modalias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:adapter: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("adapter", "Adapter", "Adapter", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:manufacturer-data: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.ManufacturerData">"ManufacturerData"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_variant ("manufacturer-data", "ManufacturerData", "ManufacturerData", G_VARIANT_TYPE ("a{qv}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:service-data: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.ServiceData">"ServiceData"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_variant ("service-data", "ServiceData", "ServiceData", G_VARIANT_TYPE ("a{sv}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:tx-power: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.TxPower">"TxPower"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_int ("tx-power", "TxPower", "TxPower", G_MININT16, G_MAXINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * Device1:services-resolved: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.ServicesResolved">"ServicesResolved"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("services-resolved", "ServicesResolved", "ServicesResolved", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -/** - * device1_get_address: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_address() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -device1_get_address (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_address (object); -} - -/** - * device1_dup_address: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -device1_dup_address (Device1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "address", &value, NULL); - return value; -} - -/** - * device1_set_address: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_address (Device1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "address", value, NULL); -} - -/** - * device1_get_name: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_name() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -device1_get_name (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_name (object); -} - -/** - * device1_dup_name: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -device1_dup_name (Device1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "name", &value, NULL); - return value; -} - -/** - * device1_set_name: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_name (Device1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "name", value, NULL); -} - -/** - * device1_get_alias: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_alias() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -device1_get_alias (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_alias (object); -} - -/** - * device1_dup_alias: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -device1_dup_alias (Device1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "alias", &value, NULL); - return value; -} - -/** - * device1_set_alias: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -device1_set_alias (Device1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "alias", value, NULL); -} - -/** - * device1_get_class: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Class">"Class"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -guint -device1_get_class (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_class (object); -} - -/** - * device1_set_class: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Class">"Class"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_class (Device1 *object, guint value) -{ - g_object_set (G_OBJECT (object), "class", value, NULL); -} - -/** - * device1_get_appearance: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Appearance">"Appearance"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -guint16 -device1_get_appearance (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_appearance (object); -} - -/** - * device1_set_appearance: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Appearance">"Appearance"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_appearance (Device1 *object, guint16 value) -{ - g_object_set (G_OBJECT (object), "appearance", value, NULL); -} - -/** - * device1_get_icon: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_icon() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -device1_get_icon (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_icon (object); -} - -/** - * device1_dup_icon: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -device1_dup_icon (Device1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "icon", &value, NULL); - return value; -} - -/** - * device1_set_icon: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_icon (Device1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "icon", value, NULL); -} - -/** - * device1_get_paired: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Paired">"Paired"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -device1_get_paired (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_paired (object); -} - -/** - * device1_set_paired: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Paired">"Paired"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_paired (Device1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "paired", value, NULL); -} - -/** - * device1_get_trusted: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Trusted">"Trusted"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -device1_get_trusted (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_trusted (object); -} - -/** - * device1_set_trusted: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Trusted">"Trusted"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -device1_set_trusted (Device1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "trusted", value, NULL); -} - -/** - * device1_get_blocked: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Blocked">"Blocked"</link> D-Bus property. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -device1_get_blocked (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_blocked (object); -} - -/** - * device1_set_blocked: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Blocked">"Blocked"</link> D-Bus property to @value. - * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. - */ -void -device1_set_blocked (Device1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "blocked", value, NULL); -} - -/** - * device1_get_legacy_pairing: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.LegacyPairing">"LegacyPairing"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -device1_get_legacy_pairing (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_legacy_pairing (object); -} - -/** - * device1_set_legacy_pairing: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.LegacyPairing">"LegacyPairing"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_legacy_pairing (Device1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "legacy-pairing", value, NULL); -} - -/** - * device1_get_rssi: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.RSSI">"RSSI"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gint16 -device1_get_rssi (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_rssi (object); -} - -/** - * device1_set_rssi: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.RSSI">"RSSI"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_rssi (Device1 *object, gint16 value) -{ - g_object_set (G_OBJECT (object), "rssi", value, NULL); -} - -/** - * device1_get_connected: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Connected">"Connected"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -device1_get_connected (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_connected (object); -} - -/** - * device1_set_connected: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Connected">"Connected"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_connected (Device1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "connected", value, NULL); -} - -/** - * device1_get_uuids: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_uuids() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -device1_get_uuids (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_uuids (object); -} - -/** - * device1_dup_uuids: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -device1_dup_uuids (Device1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "uuids", &value, NULL); - return value; -} - -/** - * device1_set_uuids: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_uuids (Device1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "uuids", value, NULL); -} - -/** - * device1_get_modalias: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_modalias() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -device1_get_modalias (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_modalias (object); -} - -/** - * device1_dup_modalias: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -device1_dup_modalias (Device1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "modalias", &value, NULL); - return value; -} - -/** - * device1_set_modalias: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_modalias (Device1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "modalias", value, NULL); -} - -/** - * device1_get_adapter: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_adapter() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -device1_get_adapter (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_adapter (object); -} - -/** - * device1_dup_adapter: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -device1_dup_adapter (Device1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "adapter", &value, NULL); - return value; -} - -/** - * device1_set_adapter: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_adapter (Device1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "adapter", value, NULL); -} - -/** - * device1_get_manufacturer_data: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.ManufacturerData">"ManufacturerData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_manufacturer_data() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -GVariant * -device1_get_manufacturer_data (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_manufacturer_data (object); -} - -/** - * device1_dup_manufacturer_data: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.ManufacturerData">"ManufacturerData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). - */ -GVariant * -device1_dup_manufacturer_data (Device1 *object) -{ - GVariant *value; - g_object_get (G_OBJECT (object), "manufacturer-data", &value, NULL); - return value; -} - -/** - * device1_set_manufacturer_data: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.ManufacturerData">"ManufacturerData"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_manufacturer_data (Device1 *object, GVariant *value) -{ - g_object_set (G_OBJECT (object), "manufacturer-data", value, NULL); -} - -/** - * device1_get_service_data: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.ServiceData">"ServiceData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_service_data() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -GVariant * -device1_get_service_data (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_service_data (object); -} - -/** - * device1_dup_service_data: (skip) - * @object: A #Device1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.ServiceData">"ServiceData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). - */ -GVariant * -device1_dup_service_data (Device1 *object) -{ - GVariant *value; - g_object_get (G_OBJECT (object), "service-data", &value, NULL); - return value; -} - -/** - * device1_set_service_data: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.ServiceData">"ServiceData"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_service_data (Device1 *object, GVariant *value) -{ - g_object_set (G_OBJECT (object), "service-data", value, NULL); -} - -/** - * device1_get_tx_power: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.TxPower">"TxPower"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gint16 -device1_get_tx_power (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_tx_power (object); -} - -/** - * device1_set_tx_power: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.TxPower">"TxPower"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_tx_power (Device1 *object, gint16 value) -{ - g_object_set (G_OBJECT (object), "tx-power", value, NULL); -} - -/** - * device1_get_services_resolved: (skip) - * @object: A #Device1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.ServicesResolved">"ServicesResolved"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -device1_get_services_resolved (Device1 *object) -{ - return DEVICE1_GET_IFACE (object)->get_services_resolved (object); -} - -/** - * device1_set_services_resolved: (skip) - * @object: A #Device1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-Device1.ServicesResolved">"ServicesResolved"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -device1_set_services_resolved (Device1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "services-resolved", value, NULL); -} - -/** - * device1_call_disconnect: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method on @proxy. - * 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. - * You can then call device1_call_disconnect_finish() to get the result of the operation. - * - * See device1_call_disconnect_sync() for the synchronous, blocking version of this method. - */ -void -device1_call_disconnect ( - Device1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "Disconnect", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * device1_call_disconnect_finish: - * @proxy: A #Device1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_disconnect(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with device1_call_disconnect(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_disconnect_finish ( - Device1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_disconnect_sync: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See device1_call_disconnect() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_disconnect_sync ( - Device1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "Disconnect", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_connect: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method on @proxy. - * 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. - * You can then call device1_call_connect_finish() to get the result of the operation. - * - * See device1_call_connect_sync() for the synchronous, blocking version of this method. - */ -void -device1_call_connect ( - Device1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "Connect", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * device1_call_connect_finish: - * @proxy: A #Device1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_connect(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with device1_call_connect(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_connect_finish ( - Device1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_connect_sync: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See device1_call_connect() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_connect_sync ( - Device1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "Connect", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_connect_profile: - * @proxy: A #Device1Proxy. - * @arg_UUID: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method on @proxy. - * 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. - * You can then call device1_call_connect_profile_finish() to get the result of the operation. - * - * See device1_call_connect_profile_sync() for the synchronous, blocking version of this method. - */ -void -device1_call_connect_profile ( - Device1 *proxy, - const gchar *arg_UUID, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "ConnectProfile", - g_variant_new ("(s)", - arg_UUID), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * device1_call_connect_profile_finish: - * @proxy: A #Device1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_connect_profile(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with device1_call_connect_profile(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_connect_profile_finish ( - Device1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_connect_profile_sync: - * @proxy: A #Device1Proxy. - * @arg_UUID: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See device1_call_connect_profile() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_connect_profile_sync ( - Device1 *proxy, - const gchar *arg_UUID, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "ConnectProfile", - g_variant_new ("(s)", - arg_UUID), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_disconnect_profile: - * @proxy: A #Device1Proxy. - * @arg_UUID: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method on @proxy. - * 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. - * You can then call device1_call_disconnect_profile_finish() to get the result of the operation. - * - * See device1_call_disconnect_profile_sync() for the synchronous, blocking version of this method. - */ -void -device1_call_disconnect_profile ( - Device1 *proxy, - const gchar *arg_UUID, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "DisconnectProfile", - g_variant_new ("(s)", - arg_UUID), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * device1_call_disconnect_profile_finish: - * @proxy: A #Device1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_disconnect_profile(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with device1_call_disconnect_profile(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_disconnect_profile_finish ( - Device1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_disconnect_profile_sync: - * @proxy: A #Device1Proxy. - * @arg_UUID: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See device1_call_disconnect_profile() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_disconnect_profile_sync ( - Device1 *proxy, - const gchar *arg_UUID, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "DisconnectProfile", - g_variant_new ("(s)", - arg_UUID), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_pair: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method on @proxy. - * 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. - * You can then call device1_call_pair_finish() to get the result of the operation. - * - * See device1_call_pair_sync() for the synchronous, blocking version of this method. - */ -void -device1_call_pair ( - Device1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "Pair", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * device1_call_pair_finish: - * @proxy: A #Device1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_pair(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with device1_call_pair(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_pair_finish ( - Device1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_pair_sync: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See device1_call_pair() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_pair_sync ( - Device1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "Pair", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_cancel_pairing: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method on @proxy. - * 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. - * You can then call device1_call_cancel_pairing_finish() to get the result of the operation. - * - * See device1_call_cancel_pairing_sync() for the synchronous, blocking version of this method. - */ -void -device1_call_cancel_pairing ( - Device1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "CancelPairing", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * device1_call_cancel_pairing_finish: - * @proxy: A #Device1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_cancel_pairing(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with device1_call_cancel_pairing(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_cancel_pairing_finish ( - Device1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_call_cancel_pairing_sync: - * @proxy: A #Device1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See device1_call_cancel_pairing() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -device1_call_cancel_pairing_sync ( - Device1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "CancelPairing", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * device1_complete_disconnect: - * @object: A #Device1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -device1_complete_disconnect ( - Device1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * device1_complete_connect: - * @object: A #Device1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -device1_complete_connect ( - Device1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * device1_complete_connect_profile: - * @object: A #Device1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -device1_complete_connect_profile ( - Device1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * device1_complete_disconnect_profile: - * @object: A #Device1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -device1_complete_disconnect_profile ( - Device1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * device1_complete_pair: - * @object: A #Device1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -device1_complete_pair ( - Device1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * device1_complete_cancel_pairing: - * @object: A #Device1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -device1_complete_cancel_pairing ( - Device1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/* ------------------------------------------------------------------------ */ - -/** - * Device1Proxy: - * - * The #Device1Proxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * Device1ProxyClass: - * @parent_class: The parent class. - * - * Class structure for #Device1Proxy. - */ - -struct _Device1ProxyPrivate -{ - GData *qdata; -}; - -static void device1_proxy_iface_init (Device1Iface *iface); - -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (Device1Proxy, device1_proxy, G_TYPE_DBUS_PROXY, - G_ADD_PRIVATE (Device1Proxy) - G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_proxy_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (Device1Proxy, device1_proxy, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_proxy_iface_init)); - -#endif -static void -device1_proxy_finalize (GObject *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - g_datalist_clear (&proxy->priv->qdata); - G_OBJECT_CLASS (device1_proxy_parent_class)->finalize (object); -} - -static void -device1_proxy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 19); - info = _device1_property_info_pointers[prop_id - 1]; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); - if (info->use_gvariant) - { - g_value_set_variant (value, variant); - } - else - { - if (variant != NULL) - g_dbus_gvariant_to_gvalue (variant, value); - } - if (variant != NULL) - g_variant_unref (variant); -} - -static void -device1_proxy_set_property_cb (GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - const _ExtendedGDBusPropertyInfo *info = user_data; - GError *error; - GVariant *_ret; - error = NULL; - _ret = g_dbus_proxy_call_finish (proxy, res, &error); - if (!_ret) - { - g_warning ("Error setting property '%s' on interface org.bluez.Device1: %s (%s, %d)", - info->parent_struct.name, - error->message, g_quark_to_string (error->domain), error->code); - g_error_free (error); - } - else - { - g_variant_unref (_ret); - } -} - -static void -device1_proxy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 19); - info = _device1_property_info_pointers[prop_id - 1]; - variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_dbus_proxy_call (G_DBUS_PROXY (object), - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", "org.bluez.Device1", info->parent_struct.name, variant), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, (GAsyncReadyCallback) device1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); - g_variant_unref (variant); -} - -static void -device1_proxy_g_signal (GDBusProxy *proxy, - const gchar *sender_name G_GNUC_UNUSED, - const gchar *signal_name, - GVariant *parameters) -{ - _ExtendedGDBusSignalInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint n; - guint signal_id; - info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, signal_name); - if (info == NULL) - return; - num_params = g_variant_n_children (parameters); - paramv = g_new0 (GValue, num_params + 1); - g_value_init (¶mv[0], TYPE_DEVICE1); - g_value_set_object (¶mv[0], proxy); - g_variant_iter_init (&iter, parameters); - n = 1; - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_DEVICE1); - g_signal_emitv (paramv, signal_id, 0, NULL); - for (n = 0; n < num_params + 1; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static void -device1_proxy_g_properties_changed (GDBusProxy *_proxy, - GVariant *changed_properties, - const gchar *const *invalidated_properties) -{ - Device1Proxy *proxy = DEVICE1_PROXY (_proxy); - guint n; - const gchar *key; - GVariantIter *iter; - _ExtendedGDBusPropertyInfo *info; - g_variant_get (changed_properties, "a{sv}", &iter); - while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, key); - g_datalist_remove_data (&proxy->priv->qdata, key); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } - g_variant_iter_free (iter); - for (n = 0; invalidated_properties[n] != NULL; n++) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, invalidated_properties[n]); - g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } -} - -static const gchar * -device1_proxy_get_address (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Address"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -device1_proxy_get_name (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -device1_proxy_get_alias (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Alias"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static guint -device1_proxy_get_class (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - guint value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Class"); - if (variant != NULL) - { - value = g_variant_get_uint32 (variant); - g_variant_unref (variant); - } - return value; -} - -static guint16 -device1_proxy_get_appearance (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - guint16 value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Appearance"); - if (variant != NULL) - { - value = g_variant_get_uint16 (variant); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -device1_proxy_get_icon (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Icon"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static gboolean -device1_proxy_get_paired (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Paired"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -device1_proxy_get_trusted (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Trusted"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -device1_proxy_get_blocked (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Blocked"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -device1_proxy_get_legacy_pairing (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LegacyPairing"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static gint16 -device1_proxy_get_rssi (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gint16 value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "RSSI"); - if (variant != NULL) - { - value = g_variant_get_int16 (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -device1_proxy_get_connected (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Connected"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static const gchar *const * -device1_proxy_get_uuids (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - value = g_datalist_get_data (&proxy->priv->qdata, "UUIDs"); - if (value != NULL) - return value; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUIDs"); - if (variant != NULL) - { - value = g_variant_get_strv (variant, NULL); - g_datalist_set_data_full (&proxy->priv->qdata, "UUIDs", (gpointer) value, g_free); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -device1_proxy_get_modalias (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Modalias"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -device1_proxy_get_adapter (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Adapter"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static GVariant * -device1_proxy_get_manufacturer_data (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - GVariant *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ManufacturerData"); - value = variant; - if (variant != NULL) - g_variant_unref (variant); - return value; -} - -static GVariant * -device1_proxy_get_service_data (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - GVariant *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ServiceData"); - value = variant; - if (variant != NULL) - g_variant_unref (variant); - return value; -} - -static gint16 -device1_proxy_get_tx_power (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gint16 value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "TxPower"); - if (variant != NULL) - { - value = g_variant_get_int16 (variant); - g_variant_unref (variant); - } - return value; -} - -static gboolean -device1_proxy_get_services_resolved (Device1 *object) -{ - Device1Proxy *proxy = DEVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ServicesResolved"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static void -device1_proxy_init (Device1Proxy *proxy) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - proxy->priv = device1_proxy_get_instance_private (proxy); -#else - proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DEVICE1_PROXY, Device1ProxyPrivate); -#endif - - g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), device1_interface_info ()); -} - -static void -device1_proxy_class_init (Device1ProxyClass *klass) -{ - GObjectClass *gobject_class; - GDBusProxyClass *proxy_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = device1_proxy_finalize; - gobject_class->get_property = device1_proxy_get_property; - gobject_class->set_property = device1_proxy_set_property; - - proxy_class = G_DBUS_PROXY_CLASS (klass); - proxy_class->g_signal = device1_proxy_g_signal; - proxy_class->g_properties_changed = device1_proxy_g_properties_changed; - - device1_override_properties (gobject_class, 1); - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (Device1ProxyPrivate)); -#endif -} - -static void -device1_proxy_iface_init (Device1Iface *iface) -{ - iface->get_address = device1_proxy_get_address; - iface->get_name = device1_proxy_get_name; - iface->get_alias = device1_proxy_get_alias; - iface->get_class = device1_proxy_get_class; - iface->get_appearance = device1_proxy_get_appearance; - iface->get_icon = device1_proxy_get_icon; - iface->get_paired = device1_proxy_get_paired; - iface->get_trusted = device1_proxy_get_trusted; - iface->get_blocked = device1_proxy_get_blocked; - iface->get_legacy_pairing = device1_proxy_get_legacy_pairing; - iface->get_rssi = device1_proxy_get_rssi; - iface->get_connected = device1_proxy_get_connected; - iface->get_uuids = device1_proxy_get_uuids; - iface->get_modalias = device1_proxy_get_modalias; - iface->get_adapter = device1_proxy_get_adapter; - iface->get_manufacturer_data = device1_proxy_get_manufacturer_data; - iface->get_service_data = device1_proxy_get_service_data; - iface->get_tx_power = device1_proxy_get_tx_power; - iface->get_services_resolved = device1_proxy_get_services_resolved; -} - -/** - * device1_proxy_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. See g_dbus_proxy_new() for more details. - * - * 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. - * You can then call device1_proxy_new_finish() to get the result of the operation. - * - * See device1_proxy_new_sync() for the synchronous, blocking version of this constructor. - */ -void -device1_proxy_new ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_DEVICE1_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.Device1", NULL); -} - -/** - * device1_proxy_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_proxy_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with device1_proxy_new(). - * - * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Device1 * -device1_proxy_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return DEVICE1 (ret); - else - return NULL; -} - -/** - * device1_proxy_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. See g_dbus_proxy_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See device1_proxy_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Device1 * -device1_proxy_new_sync ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_DEVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); - if (ret != NULL) - return DEVICE1 (ret); - else - return NULL; -} - - -/** - * device1_proxy_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like device1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call device1_proxy_new_for_bus_finish() to get the result of the operation. - * - * See device1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -device1_proxy_new_for_bus ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_DEVICE1_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.Device1", NULL); -} - -/** - * device1_proxy_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_proxy_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with device1_proxy_new_for_bus(). - * - * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Device1 * -device1_proxy_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return DEVICE1 (ret); - else - return NULL; -} - -/** - * device1_proxy_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like device1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See device1_proxy_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. - */ -Device1 * -device1_proxy_new_for_bus_sync ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_DEVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); - if (ret != NULL) - return DEVICE1 (ret); - else - return NULL; -} - - -/* ------------------------------------------------------------------------ */ - -/** - * Device1Skeleton: - * - * The #Device1Skeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * Device1SkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #Device1Skeleton. - */ - -struct _Device1SkeletonPrivate -{ - GValue *properties; - GList *changed_properties; - GSource *changed_properties_idle_source; - GMainContext *context; - GMutex lock; -}; - -static void -_device1_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) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); - _ExtendedGDBusMethodInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint num_extra; - guint n; - guint signal_id; - GValue return_value = G_VALUE_INIT; - info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); - g_assert (info != NULL); - num_params = g_variant_n_children (parameters); - num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); - n = 0; - g_value_init (¶mv[n], TYPE_DEVICE1); - g_value_set_object (¶mv[n++], skeleton); - g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); - g_value_set_object (¶mv[n++], invocation); - if (info->pass_fdlist) - { -#ifdef G_OS_UNIX - g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); - g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); -#else - g_assert_not_reached (); -#endif - } - g_variant_iter_init (&iter, parameters); - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_DEVICE1); - g_value_init (&return_value, G_TYPE_BOOLEAN); - g_signal_emitv (paramv, signal_id, 0, &return_value); - if (!g_value_get_boolean (&return_value)) - 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); - g_value_unset (&return_value); - for (n = 0; n < num_params + num_extra; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static GVariant * -_device1_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) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - GVariant *ret; - ret = NULL; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - g_value_init (&value, pspec->value_type); - g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); - ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_value_unset (&value); - } - return ret; -} - -static gboolean -_device1_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) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - gboolean ret; - ret = FALSE; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - if (info->use_gvariant) - g_value_set_variant (&value, variant); - else - g_dbus_gvariant_to_gvalue (variant, &value); - g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); - g_value_unset (&value); - ret = TRUE; - } - return ret; -} - -static const GDBusInterfaceVTable _device1_skeleton_vtable = -{ - _device1_skeleton_handle_method_call, - _device1_skeleton_handle_get_property, - _device1_skeleton_handle_set_property, - {NULL} -}; - -static GDBusInterfaceInfo * -device1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return device1_interface_info (); -} - -static GDBusInterfaceVTable * -device1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return (GDBusInterfaceVTable *) &_device1_skeleton_vtable; -} - -static GVariant * -device1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (_skeleton); - - GVariantBuilder builder; - guint n; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - if (_device1_interface_info.parent_struct.properties == NULL) - goto out; - for (n = 0; _device1_interface_info.parent_struct.properties[n] != NULL; n++) - { - GDBusPropertyInfo *info = _device1_interface_info.parent_struct.properties[n]; - if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) - { - GVariant *value; - value = _device1_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.Device1", info->name, NULL, skeleton); - if (value != NULL) - { - g_variant_take_ref (value); - g_variant_builder_add (&builder, "{sv}", info->name, value); - g_variant_unref (value); - } - } - } -out: - return g_variant_builder_end (&builder); -} - -static gboolean _device1_emit_changed (gpointer user_data); - -static void -device1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (_skeleton); - gboolean emit_changed = FALSE; - - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties_idle_source != NULL) - { - g_source_destroy (skeleton->priv->changed_properties_idle_source); - skeleton->priv->changed_properties_idle_source = NULL; - emit_changed = TRUE; - } - g_mutex_unlock (&skeleton->priv->lock); - - if (emit_changed) - _device1_emit_changed (skeleton); -} - -static void device1_skeleton_iface_init (Device1Iface *iface); -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (Device1Skeleton, device1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_ADD_PRIVATE (Device1Skeleton) - G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_skeleton_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (Device1Skeleton, device1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_skeleton_iface_init)); - -#endif -static void -device1_skeleton_finalize (GObject *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - guint n; - for (n = 0; n < 19; n++) - g_value_unset (&skeleton->priv->properties[n]); - g_free (skeleton->priv->properties); - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - if (skeleton->priv->changed_properties_idle_source != NULL) - g_source_destroy (skeleton->priv->changed_properties_idle_source); - g_main_context_unref (skeleton->priv->context); - g_mutex_clear (&skeleton->priv->lock); - G_OBJECT_CLASS (device1_skeleton_parent_class)->finalize (object); -} - -static void -device1_skeleton_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 19); - g_mutex_lock (&skeleton->priv->lock); - g_value_copy (&skeleton->priv->properties[prop_id - 1], value); - g_mutex_unlock (&skeleton->priv->lock); -} - -static gboolean -_device1_emit_changed (gpointer user_data) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); - GList *l; - GVariantBuilder builder; - GVariantBuilder invalidated_builder; - guint num_changes; - - g_mutex_lock (&skeleton->priv->lock); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); - for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) - { - ChangedProperty *cp = l->data; - GVariant *variant; - const GValue *cur_value; - - cur_value = &skeleton->priv->properties[cp->prop_id - 1]; - if (!_g_value_equal (cur_value, &cp->orig_value)) - { - variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); - g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); - g_variant_unref (variant); - num_changes++; - } - } - if (num_changes > 0) - { - GList *connections, *ll; - GVariant *signal_variant; - signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.Device1", - &builder, &invalidated_builder)); - connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); - for (ll = connections; ll != NULL; ll = ll->next) - { - GDBusConnection *connection = ll->data; - - g_dbus_connection_emit_signal (connection, - NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - signal_variant, - NULL); - } - g_variant_unref (signal_variant); - g_list_free_full (connections, g_object_unref); - } - else - { - g_variant_builder_clear (&builder); - g_variant_builder_clear (&invalidated_builder); - } - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - skeleton->priv->changed_properties = NULL; - skeleton->priv->changed_properties_idle_source = NULL; - g_mutex_unlock (&skeleton->priv->lock); - return FALSE; -} - -static void -_device1_schedule_emit_changed (Device1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) -{ - ChangedProperty *cp; - GList *l; - cp = NULL; - for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) - { - ChangedProperty *i_cp = l->data; - if (i_cp->info == info) - { - cp = i_cp; - break; - } - } - if (cp == NULL) - { - cp = g_new0 (ChangedProperty, 1); - cp->prop_id = prop_id; - cp->info = info; - skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); - g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); - g_value_copy (orig_value, &cp->orig_value); - } -} - -static void -device1_skeleton_notify (GObject *object, - GParamSpec *pspec G_GNUC_UNUSED) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties != NULL && - skeleton->priv->changed_properties_idle_source == NULL) - { - skeleton->priv->changed_properties_idle_source = g_idle_source_new (); - g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); - g_source_set_callback (skeleton->priv->changed_properties_idle_source, _device1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); - g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _device1_emit_changed"); - g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); - g_source_unref (skeleton->priv->changed_properties_idle_source); - } - g_mutex_unlock (&skeleton->priv->lock); -} - -static void -device1_skeleton_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 19); - g_mutex_lock (&skeleton->priv->lock); - g_object_freeze_notify (object); - if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) - { - if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) - _device1_schedule_emit_changed (skeleton, _device1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); - g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); - g_object_notify_by_pspec (object, pspec); - } - g_mutex_unlock (&skeleton->priv->lock); - g_object_thaw_notify (object); -} - -static void -device1_skeleton_init (Device1Skeleton *skeleton) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - skeleton->priv = device1_skeleton_get_instance_private (skeleton); -#else - skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DEVICE1_SKELETON, Device1SkeletonPrivate); -#endif - - g_mutex_init (&skeleton->priv->lock); - skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 19); - g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[3], G_TYPE_UINT); - g_value_init (&skeleton->priv->properties[4], G_TYPE_UINT); - g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[6], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[7], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[8], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[10], G_TYPE_INT); - g_value_init (&skeleton->priv->properties[11], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[12], G_TYPE_STRV); - g_value_init (&skeleton->priv->properties[13], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[14], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[15], G_TYPE_VARIANT); - g_value_init (&skeleton->priv->properties[16], G_TYPE_VARIANT); - g_value_init (&skeleton->priv->properties[17], G_TYPE_INT); - g_value_init (&skeleton->priv->properties[18], G_TYPE_BOOLEAN); -} - -static const gchar * -device1_skeleton_get_address (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[0])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -device1_skeleton_get_name (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[1])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -device1_skeleton_get_alias (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[2])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static guint -device1_skeleton_get_class (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - guint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_uint (&(skeleton->priv->properties[3])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static guint16 -device1_skeleton_get_appearance (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - guint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_uint (&(skeleton->priv->properties[4])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -device1_skeleton_get_icon (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[5])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -device1_skeleton_get_paired (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[6])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -device1_skeleton_get_trusted (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[7])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -device1_skeleton_get_blocked (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[8])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -device1_skeleton_get_legacy_pairing (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[9])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gint16 -device1_skeleton_get_rssi (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_int (&(skeleton->priv->properties[10])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -device1_skeleton_get_connected (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[11])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -device1_skeleton_get_uuids (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[12])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -device1_skeleton_get_modalias (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[13])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -device1_skeleton_get_adapter (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[14])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static GVariant * -device1_skeleton_get_manufacturer_data (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - GVariant *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_variant (&(skeleton->priv->properties[15])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static GVariant * -device1_skeleton_get_service_data (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - GVariant *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_variant (&(skeleton->priv->properties[16])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gint16 -device1_skeleton_get_tx_power (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gint value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_int (&(skeleton->priv->properties[17])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -device1_skeleton_get_services_resolved (Device1 *object) -{ - Device1Skeleton *skeleton = DEVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[18])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static void -device1_skeleton_class_init (Device1SkeletonClass *klass) -{ - GObjectClass *gobject_class; - GDBusInterfaceSkeletonClass *skeleton_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = device1_skeleton_finalize; - gobject_class->get_property = device1_skeleton_get_property; - gobject_class->set_property = device1_skeleton_set_property; - gobject_class->notify = device1_skeleton_notify; - - - device1_override_properties (gobject_class, 1); - - skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); - skeleton_class->get_info = device1_skeleton_dbus_interface_get_info; - skeleton_class->get_properties = device1_skeleton_dbus_interface_get_properties; - skeleton_class->flush = device1_skeleton_dbus_interface_flush; - skeleton_class->get_vtable = device1_skeleton_dbus_interface_get_vtable; - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (Device1SkeletonPrivate)); -#endif -} - -static void -device1_skeleton_iface_init (Device1Iface *iface) -{ - iface->get_address = device1_skeleton_get_address; - iface->get_name = device1_skeleton_get_name; - iface->get_alias = device1_skeleton_get_alias; - iface->get_class = device1_skeleton_get_class; - iface->get_appearance = device1_skeleton_get_appearance; - iface->get_icon = device1_skeleton_get_icon; - iface->get_paired = device1_skeleton_get_paired; - iface->get_trusted = device1_skeleton_get_trusted; - iface->get_blocked = device1_skeleton_get_blocked; - iface->get_legacy_pairing = device1_skeleton_get_legacy_pairing; - iface->get_rssi = device1_skeleton_get_rssi; - iface->get_connected = device1_skeleton_get_connected; - iface->get_uuids = device1_skeleton_get_uuids; - iface->get_modalias = device1_skeleton_get_modalias; - iface->get_adapter = device1_skeleton_get_adapter; - iface->get_manufacturer_data = device1_skeleton_get_manufacturer_data; - iface->get_service_data = device1_skeleton_get_service_data; - iface->get_tx_power = device1_skeleton_get_tx_power; - iface->get_services_resolved = device1_skeleton_get_services_resolved; -} - -/** - * device1_skeleton_new: - * - * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. - * - * Returns: (transfer full) (type Device1Skeleton): The skeleton object. - */ -Device1 * -device1_skeleton_new (void) -{ - return DEVICE1 (g_object_new (TYPE_DEVICE1_SKELETON, NULL)); -} - -/* ------------------------------------------------------------------------ - * Code for interface org.bluez.GattService1 - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:GattService1 - * @title: GattService1 - * @short_description: Generated C code for the org.bluez.GattService1 D-Bus interface - * - * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> D-Bus interface in C. - */ - -/* ---- Introspection data for org.bluez.GattService1 ---- */ - -static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_uuid = -{ - { - -1, - (gchar *) "UUID", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "uuid", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_device = -{ - { - -1, - (gchar *) "Device", - (gchar *) "o", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "device", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_primary = -{ - { - -1, - (gchar *) "Primary", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "primary", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_characteristics = -{ - { - -1, - (gchar *) "Characteristics", - (gchar *) "ao", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "characteristics", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo * const _gatt_service1_property_info_pointers[] = -{ - &_gatt_service1_property_info_uuid, - &_gatt_service1_property_info_device, - &_gatt_service1_property_info_primary, - &_gatt_service1_property_info_characteristics, - NULL -}; - -static const _ExtendedGDBusInterfaceInfo _gatt_service1_interface_info = -{ - { - -1, - (gchar *) "org.bluez.GattService1", - NULL, - NULL, - (GDBusPropertyInfo **) &_gatt_service1_property_info_pointers, - NULL - }, - "gatt-service1", -}; - - -/** - * gatt_service1_interface_info: - * - * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> D-Bus interface. - * - * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. - */ -GDBusInterfaceInfo * -gatt_service1_interface_info (void) -{ - return (GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct; -} - -/** - * gatt_service1_override_properties: - * @klass: The class structure for a #GObject<!-- -->-derived class. - * @property_id_begin: The property id to assign to the first overridden property. - * - * Overrides all #GObject properties in the #GattService1 interface for a concrete class. - * The properties are overridden in the order they are defined. - * - * Returns: The last property id. - */ -guint -gatt_service1_override_properties (GObjectClass *klass, guint property_id_begin) -{ - g_object_class_override_property (klass, property_id_begin++, "uuid"); - g_object_class_override_property (klass, property_id_begin++, "device"); - g_object_class_override_property (klass, property_id_begin++, "primary"); - g_object_class_override_property (klass, property_id_begin++, "characteristics"); - return property_id_begin - 1; -} - - - -/** - * GattService1: - * - * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. - */ - -/** - * GattService1Iface: - * @parent_iface: The parent interface. - * @get_characteristics: Getter for the #GattService1:characteristics property. - * @get_device: Getter for the #GattService1:device property. - * @get_primary: Getter for the #GattService1:primary property. - * @get_uuid: Getter for the #GattService1:uuid property. - * - * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. - */ - -typedef GattService1Iface GattService1Interface; -G_DEFINE_INTERFACE (GattService1, gatt_service1, G_TYPE_OBJECT); - -static void -gatt_service1_default_init (GattService1Iface *iface) -{ - /* GObject properties for D-Bus properties: */ - /** - * GattService1:uuid: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattService1:device: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("device", "Device", "Device", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattService1:primary: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.Primary">"Primary"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("primary", "Primary", "Primary", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattService1:characteristics: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("characteristics", "Characteristics", "Characteristics", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -/** - * gatt_service1_get_uuid: (skip) - * @object: A #GattService1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_service1_dup_uuid() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_service1_get_uuid (GattService1 *object) -{ - return GATT_SERVICE1_GET_IFACE (object)->get_uuid (object); -} - -/** - * gatt_service1_dup_uuid: (skip) - * @object: A #GattService1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_service1_dup_uuid (GattService1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "uuid", &value, NULL); - return value; -} - -/** - * gatt_service1_set_uuid: (skip) - * @object: A #GattService1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_service1_set_uuid (GattService1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "uuid", value, NULL); -} - -/** - * gatt_service1_get_device: (skip) - * @object: A #GattService1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_service1_dup_device() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_service1_get_device (GattService1 *object) -{ - return GATT_SERVICE1_GET_IFACE (object)->get_device (object); -} - -/** - * gatt_service1_dup_device: (skip) - * @object: A #GattService1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_service1_dup_device (GattService1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "device", &value, NULL); - return value; -} - -/** - * gatt_service1_set_device: (skip) - * @object: A #GattService1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_service1_set_device (GattService1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "device", value, NULL); -} - -/** - * gatt_service1_get_primary: (skip) - * @object: A #GattService1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.Primary">"Primary"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -gatt_service1_get_primary (GattService1 *object) -{ - return GATT_SERVICE1_GET_IFACE (object)->get_primary (object); -} - -/** - * gatt_service1_set_primary: (skip) - * @object: A #GattService1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattService1.Primary">"Primary"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_service1_set_primary (GattService1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "primary", value, NULL); -} - -/** - * gatt_service1_get_characteristics: (skip) - * @object: A #GattService1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_service1_dup_characteristics() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -gatt_service1_get_characteristics (GattService1 *object) -{ - return GATT_SERVICE1_GET_IFACE (object)->get_characteristics (object); -} - -/** - * gatt_service1_dup_characteristics: (skip) - * @object: A #GattService1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -gatt_service1_dup_characteristics (GattService1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "characteristics", &value, NULL); - return value; -} - -/** - * gatt_service1_set_characteristics: (skip) - * @object: A #GattService1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_service1_set_characteristics (GattService1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "characteristics", value, NULL); -} - -/* ------------------------------------------------------------------------ */ - -/** - * GattService1Proxy: - * - * The #GattService1Proxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * GattService1ProxyClass: - * @parent_class: The parent class. - * - * Class structure for #GattService1Proxy. - */ - -struct _GattService1ProxyPrivate -{ - GData *qdata; -}; - -static void gatt_service1_proxy_iface_init (GattService1Iface *iface); - -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (GattService1Proxy, gatt_service1_proxy, G_TYPE_DBUS_PROXY, - G_ADD_PRIVATE (GattService1Proxy) - G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_proxy_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (GattService1Proxy, gatt_service1_proxy, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_proxy_iface_init)); - -#endif -static void -gatt_service1_proxy_finalize (GObject *object) -{ - GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); - g_datalist_clear (&proxy->priv->qdata); - G_OBJECT_CLASS (gatt_service1_proxy_parent_class)->finalize (object); -} - -static void -gatt_service1_proxy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 4); - info = _gatt_service1_property_info_pointers[prop_id - 1]; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); - if (info->use_gvariant) - { - g_value_set_variant (value, variant); - } - else - { - if (variant != NULL) - g_dbus_gvariant_to_gvalue (variant, value); - } - if (variant != NULL) - g_variant_unref (variant); -} - -static void -gatt_service1_proxy_set_property_cb (GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - const _ExtendedGDBusPropertyInfo *info = user_data; - GError *error; - GVariant *_ret; - error = NULL; - _ret = g_dbus_proxy_call_finish (proxy, res, &error); - if (!_ret) - { - g_warning ("Error setting property '%s' on interface org.bluez.GattService1: %s (%s, %d)", - info->parent_struct.name, - error->message, g_quark_to_string (error->domain), error->code); - g_error_free (error); - } - else - { - g_variant_unref (_ret); - } -} - -static void -gatt_service1_proxy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 4); - info = _gatt_service1_property_info_pointers[prop_id - 1]; - variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_dbus_proxy_call (G_DBUS_PROXY (object), - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", "org.bluez.GattService1", info->parent_struct.name, variant), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, (GAsyncReadyCallback) gatt_service1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); - g_variant_unref (variant); -} - -static void -gatt_service1_proxy_g_signal (GDBusProxy *proxy, - const gchar *sender_name G_GNUC_UNUSED, - const gchar *signal_name, - GVariant *parameters) -{ - _ExtendedGDBusSignalInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint n; - guint signal_id; - info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, signal_name); - if (info == NULL) - return; - num_params = g_variant_n_children (parameters); - paramv = g_new0 (GValue, num_params + 1); - g_value_init (¶mv[0], TYPE_GATT_SERVICE1); - g_value_set_object (¶mv[0], proxy); - g_variant_iter_init (&iter, parameters); - n = 1; - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_SERVICE1); - g_signal_emitv (paramv, signal_id, 0, NULL); - for (n = 0; n < num_params + 1; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static void -gatt_service1_proxy_g_properties_changed (GDBusProxy *_proxy, - GVariant *changed_properties, - const gchar *const *invalidated_properties) -{ - GattService1Proxy *proxy = GATT_SERVICE1_PROXY (_proxy); - guint n; - const gchar *key; - GVariantIter *iter; - _ExtendedGDBusPropertyInfo *info; - g_variant_get (changed_properties, "a{sv}", &iter); - while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, key); - g_datalist_remove_data (&proxy->priv->qdata, key); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } - g_variant_iter_free (iter); - for (n = 0; invalidated_properties[n] != NULL; n++) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, invalidated_properties[n]); - g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } -} - -static const gchar * -gatt_service1_proxy_get_uuid (GattService1 *object) -{ - GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUID"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -gatt_service1_proxy_get_device (GattService1 *object) -{ - GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Device"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static gboolean -gatt_service1_proxy_get_primary (GattService1 *object) -{ - GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Primary"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static const gchar *const * -gatt_service1_proxy_get_characteristics (GattService1 *object) -{ - GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Characteristics"); - if (variant != NULL) - { - value = g_variant_get_objv (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static void -gatt_service1_proxy_init (GattService1Proxy *proxy) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - proxy->priv = gatt_service1_proxy_get_instance_private (proxy); -#else - proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_GATT_SERVICE1_PROXY, GattService1ProxyPrivate); -#endif - - g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gatt_service1_interface_info ()); -} - -static void -gatt_service1_proxy_class_init (GattService1ProxyClass *klass) -{ - GObjectClass *gobject_class; - GDBusProxyClass *proxy_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = gatt_service1_proxy_finalize; - gobject_class->get_property = gatt_service1_proxy_get_property; - gobject_class->set_property = gatt_service1_proxy_set_property; - - proxy_class = G_DBUS_PROXY_CLASS (klass); - proxy_class->g_signal = gatt_service1_proxy_g_signal; - proxy_class->g_properties_changed = gatt_service1_proxy_g_properties_changed; - - gatt_service1_override_properties (gobject_class, 1); - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (GattService1ProxyPrivate)); -#endif -} - -static void -gatt_service1_proxy_iface_init (GattService1Iface *iface) -{ - iface->get_uuid = gatt_service1_proxy_get_uuid; - iface->get_device = gatt_service1_proxy_get_device; - iface->get_primary = gatt_service1_proxy_get_primary; - iface->get_characteristics = gatt_service1_proxy_get_characteristics; -} - -/** - * gatt_service1_proxy_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. See g_dbus_proxy_new() for more details. - * - * 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. - * You can then call gatt_service1_proxy_new_finish() to get the result of the operation. - * - * See gatt_service1_proxy_new_sync() for the synchronous, blocking version of this constructor. - */ -void -gatt_service1_proxy_new ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_GATT_SERVICE1_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.GattService1", NULL); -} - -/** - * gatt_service1_proxy_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_service1_proxy_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with gatt_service1_proxy_new(). - * - * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattService1 * -gatt_service1_proxy_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return GATT_SERVICE1 (ret); - else - return NULL; -} - -/** - * gatt_service1_proxy_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. See g_dbus_proxy_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See gatt_service1_proxy_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattService1 * -gatt_service1_proxy_new_sync ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_GATT_SERVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); - if (ret != NULL) - return GATT_SERVICE1 (ret); - else - return NULL; -} - - -/** - * gatt_service1_proxy_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like gatt_service1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call gatt_service1_proxy_new_for_bus_finish() to get the result of the operation. - * - * See gatt_service1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -gatt_service1_proxy_new_for_bus ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_GATT_SERVICE1_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.GattService1", NULL); -} - -/** - * gatt_service1_proxy_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_service1_proxy_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with gatt_service1_proxy_new_for_bus(). - * - * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattService1 * -gatt_service1_proxy_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return GATT_SERVICE1 (ret); - else - return NULL; -} - -/** - * gatt_service1_proxy_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like gatt_service1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See gatt_service1_proxy_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattService1 * -gatt_service1_proxy_new_for_bus_sync ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_GATT_SERVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); - if (ret != NULL) - return GATT_SERVICE1 (ret); - else - return NULL; -} - - -/* ------------------------------------------------------------------------ */ - -/** - * GattService1Skeleton: - * - * The #GattService1Skeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * GattService1SkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #GattService1Skeleton. - */ - -struct _GattService1SkeletonPrivate -{ - GValue *properties; - GList *changed_properties; - GSource *changed_properties_idle_source; - GMainContext *context; - GMutex lock; -}; - -static void -_gatt_service1_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) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); - _ExtendedGDBusMethodInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint num_extra; - guint n; - guint signal_id; - GValue return_value = G_VALUE_INIT; - info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); - g_assert (info != NULL); - num_params = g_variant_n_children (parameters); - num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); - n = 0; - g_value_init (¶mv[n], TYPE_GATT_SERVICE1); - g_value_set_object (¶mv[n++], skeleton); - g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); - g_value_set_object (¶mv[n++], invocation); - if (info->pass_fdlist) - { -#ifdef G_OS_UNIX - g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); - g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); -#else - g_assert_not_reached (); -#endif - } - g_variant_iter_init (&iter, parameters); - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_SERVICE1); - g_value_init (&return_value, G_TYPE_BOOLEAN); - g_signal_emitv (paramv, signal_id, 0, &return_value); - if (!g_value_get_boolean (&return_value)) - 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); - g_value_unset (&return_value); - for (n = 0; n < num_params + num_extra; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static GVariant * -_gatt_service1_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) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - GVariant *ret; - ret = NULL; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - g_value_init (&value, pspec->value_type); - g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); - ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_value_unset (&value); - } - return ret; -} - -static gboolean -_gatt_service1_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) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - gboolean ret; - ret = FALSE; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - if (info->use_gvariant) - g_value_set_variant (&value, variant); - else - g_dbus_gvariant_to_gvalue (variant, &value); - g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); - g_value_unset (&value); - ret = TRUE; - } - return ret; -} - -static const GDBusInterfaceVTable _gatt_service1_skeleton_vtable = -{ - _gatt_service1_skeleton_handle_method_call, - _gatt_service1_skeleton_handle_get_property, - _gatt_service1_skeleton_handle_set_property, - {NULL} -}; - -static GDBusInterfaceInfo * -gatt_service1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return gatt_service1_interface_info (); -} - -static GDBusInterfaceVTable * -gatt_service1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return (GDBusInterfaceVTable *) &_gatt_service1_skeleton_vtable; -} - -static GVariant * -gatt_service1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (_skeleton); - - GVariantBuilder builder; - guint n; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - if (_gatt_service1_interface_info.parent_struct.properties == NULL) - goto out; - for (n = 0; _gatt_service1_interface_info.parent_struct.properties[n] != NULL; n++) - { - GDBusPropertyInfo *info = _gatt_service1_interface_info.parent_struct.properties[n]; - if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) - { - GVariant *value; - value = _gatt_service1_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.GattService1", info->name, NULL, skeleton); - if (value != NULL) - { - g_variant_take_ref (value); - g_variant_builder_add (&builder, "{sv}", info->name, value); - g_variant_unref (value); - } - } - } -out: - return g_variant_builder_end (&builder); -} - -static gboolean _gatt_service1_emit_changed (gpointer user_data); - -static void -gatt_service1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (_skeleton); - gboolean emit_changed = FALSE; - - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties_idle_source != NULL) - { - g_source_destroy (skeleton->priv->changed_properties_idle_source); - skeleton->priv->changed_properties_idle_source = NULL; - emit_changed = TRUE; - } - g_mutex_unlock (&skeleton->priv->lock); - - if (emit_changed) - _gatt_service1_emit_changed (skeleton); -} - -static void gatt_service1_skeleton_iface_init (GattService1Iface *iface); -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (GattService1Skeleton, gatt_service1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_ADD_PRIVATE (GattService1Skeleton) - G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_skeleton_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (GattService1Skeleton, gatt_service1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_skeleton_iface_init)); - -#endif -static void -gatt_service1_skeleton_finalize (GObject *object) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - guint n; - for (n = 0; n < 4; n++) - g_value_unset (&skeleton->priv->properties[n]); - g_free (skeleton->priv->properties); - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - if (skeleton->priv->changed_properties_idle_source != NULL) - g_source_destroy (skeleton->priv->changed_properties_idle_source); - g_main_context_unref (skeleton->priv->context); - g_mutex_clear (&skeleton->priv->lock); - G_OBJECT_CLASS (gatt_service1_skeleton_parent_class)->finalize (object); -} - -static void -gatt_service1_skeleton_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 4); - g_mutex_lock (&skeleton->priv->lock); - g_value_copy (&skeleton->priv->properties[prop_id - 1], value); - g_mutex_unlock (&skeleton->priv->lock); -} - -static gboolean -_gatt_service1_emit_changed (gpointer user_data) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); - GList *l; - GVariantBuilder builder; - GVariantBuilder invalidated_builder; - guint num_changes; - - g_mutex_lock (&skeleton->priv->lock); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); - for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) - { - ChangedProperty *cp = l->data; - GVariant *variant; - const GValue *cur_value; - - cur_value = &skeleton->priv->properties[cp->prop_id - 1]; - if (!_g_value_equal (cur_value, &cp->orig_value)) - { - variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); - g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); - g_variant_unref (variant); - num_changes++; - } - } - if (num_changes > 0) - { - GList *connections, *ll; - GVariant *signal_variant; - signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.GattService1", - &builder, &invalidated_builder)); - connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); - for (ll = connections; ll != NULL; ll = ll->next) - { - GDBusConnection *connection = ll->data; - - g_dbus_connection_emit_signal (connection, - NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - signal_variant, - NULL); - } - g_variant_unref (signal_variant); - g_list_free_full (connections, g_object_unref); - } - else - { - g_variant_builder_clear (&builder); - g_variant_builder_clear (&invalidated_builder); - } - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - skeleton->priv->changed_properties = NULL; - skeleton->priv->changed_properties_idle_source = NULL; - g_mutex_unlock (&skeleton->priv->lock); - return FALSE; -} - -static void -_gatt_service1_schedule_emit_changed (GattService1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) -{ - ChangedProperty *cp; - GList *l; - cp = NULL; - for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) - { - ChangedProperty *i_cp = l->data; - if (i_cp->info == info) - { - cp = i_cp; - break; - } - } - if (cp == NULL) - { - cp = g_new0 (ChangedProperty, 1); - cp->prop_id = prop_id; - cp->info = info; - skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); - g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); - g_value_copy (orig_value, &cp->orig_value); - } -} - -static void -gatt_service1_skeleton_notify (GObject *object, - GParamSpec *pspec G_GNUC_UNUSED) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties != NULL && - skeleton->priv->changed_properties_idle_source == NULL) - { - skeleton->priv->changed_properties_idle_source = g_idle_source_new (); - g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); - g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gatt_service1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); - g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gatt_service1_emit_changed"); - g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); - g_source_unref (skeleton->priv->changed_properties_idle_source); - } - g_mutex_unlock (&skeleton->priv->lock); -} - -static void -gatt_service1_skeleton_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 4); - g_mutex_lock (&skeleton->priv->lock); - g_object_freeze_notify (object); - if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) - { - if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) - _gatt_service1_schedule_emit_changed (skeleton, _gatt_service1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); - g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); - g_object_notify_by_pspec (object, pspec); - } - g_mutex_unlock (&skeleton->priv->lock); - g_object_thaw_notify (object); -} - -static void -gatt_service1_skeleton_init (GattService1Skeleton *skeleton) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - skeleton->priv = gatt_service1_skeleton_get_instance_private (skeleton); -#else - skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_GATT_SERVICE1_SKELETON, GattService1SkeletonPrivate); -#endif - - g_mutex_init (&skeleton->priv->lock); - skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 4); - g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[2], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[3], G_TYPE_STRV); -} - -static const gchar * -gatt_service1_skeleton_get_uuid (GattService1 *object) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[0])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -gatt_service1_skeleton_get_device (GattService1 *object) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[1])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -gatt_service1_skeleton_get_primary (GattService1 *object) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[2])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -gatt_service1_skeleton_get_characteristics (GattService1 *object) -{ - GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[3])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static void -gatt_service1_skeleton_class_init (GattService1SkeletonClass *klass) -{ - GObjectClass *gobject_class; - GDBusInterfaceSkeletonClass *skeleton_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = gatt_service1_skeleton_finalize; - gobject_class->get_property = gatt_service1_skeleton_get_property; - gobject_class->set_property = gatt_service1_skeleton_set_property; - gobject_class->notify = gatt_service1_skeleton_notify; - - - gatt_service1_override_properties (gobject_class, 1); - - skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); - skeleton_class->get_info = gatt_service1_skeleton_dbus_interface_get_info; - skeleton_class->get_properties = gatt_service1_skeleton_dbus_interface_get_properties; - skeleton_class->flush = gatt_service1_skeleton_dbus_interface_flush; - skeleton_class->get_vtable = gatt_service1_skeleton_dbus_interface_get_vtable; - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (GattService1SkeletonPrivate)); -#endif -} - -static void -gatt_service1_skeleton_iface_init (GattService1Iface *iface) -{ - iface->get_uuid = gatt_service1_skeleton_get_uuid; - iface->get_device = gatt_service1_skeleton_get_device; - iface->get_primary = gatt_service1_skeleton_get_primary; - iface->get_characteristics = gatt_service1_skeleton_get_characteristics; -} - -/** - * gatt_service1_skeleton_new: - * - * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. - * - * Returns: (transfer full) (type GattService1Skeleton): The skeleton object. - */ -GattService1 * -gatt_service1_skeleton_new (void) -{ - return GATT_SERVICE1 (g_object_new (TYPE_GATT_SERVICE1_SKELETON, NULL)); -} - -/* ------------------------------------------------------------------------ - * Code for interface org.bluez.GattCharacteristic1 - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:GattCharacteristic1 - * @title: GattCharacteristic1 - * @short_description: Generated C code for the org.bluez.GattCharacteristic1 D-Bus interface - * - * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> D-Bus interface in C. - */ - -/* ---- Introspection data for org.bluez.GattCharacteristic1 ---- */ - -static const _ExtendedGDBusArgInfo _gatt_characteristic1_method_info_read_value_IN_ARG_options = -{ - { - -1, - (gchar *) "options", - (gchar *) "a{sv}", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _gatt_characteristic1_method_info_read_value_IN_ARG_pointers[] = -{ - &_gatt_characteristic1_method_info_read_value_IN_ARG_options, - NULL -}; - -static const _ExtendedGDBusArgInfo _gatt_characteristic1_method_info_read_value_OUT_ARG_value = -{ - { - -1, - (gchar *) "value", - (gchar *) "ay", - NULL - }, - TRUE -}; - -static const _ExtendedGDBusArgInfo * const _gatt_characteristic1_method_info_read_value_OUT_ARG_pointers[] = -{ - &_gatt_characteristic1_method_info_read_value_OUT_ARG_value, - NULL -}; - -static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_read_value = -{ - { - -1, - (gchar *) "ReadValue", - (GDBusArgInfo **) &_gatt_characteristic1_method_info_read_value_IN_ARG_pointers, - (GDBusArgInfo **) &_gatt_characteristic1_method_info_read_value_OUT_ARG_pointers, - NULL - }, - "handle-read-value", - FALSE -}; - -static const _ExtendedGDBusArgInfo _gatt_characteristic1_method_info_write_value_IN_ARG_value = -{ - { - -1, - (gchar *) "value", - (gchar *) "ay", - NULL - }, - TRUE -}; - -static const _ExtendedGDBusArgInfo _gatt_characteristic1_method_info_write_value_IN_ARG_options = -{ - { - -1, - (gchar *) "options", - (gchar *) "a{sv}", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _gatt_characteristic1_method_info_write_value_IN_ARG_pointers[] = -{ - &_gatt_characteristic1_method_info_write_value_IN_ARG_value, - &_gatt_characteristic1_method_info_write_value_IN_ARG_options, - NULL -}; - -static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_write_value = -{ - { - -1, - (gchar *) "WriteValue", - (GDBusArgInfo **) &_gatt_characteristic1_method_info_write_value_IN_ARG_pointers, - NULL, - NULL - }, - "handle-write-value", - FALSE -}; - -static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_start_notify = -{ - { - -1, - (gchar *) "StartNotify", - NULL, - NULL, - NULL - }, - "handle-start-notify", - FALSE -}; - -static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_stop_notify = -{ - { - -1, - (gchar *) "StopNotify", - NULL, - NULL, - NULL - }, - "handle-stop-notify", - FALSE -}; - -static const _ExtendedGDBusMethodInfo * const _gatt_characteristic1_method_info_pointers[] = -{ - &_gatt_characteristic1_method_info_read_value, - &_gatt_characteristic1_method_info_write_value, - &_gatt_characteristic1_method_info_start_notify, - &_gatt_characteristic1_method_info_stop_notify, - NULL -}; - -static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_uuid = -{ - { - -1, - (gchar *) "UUID", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "uuid", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_service = -{ - { - -1, - (gchar *) "Service", - (gchar *) "o", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "service", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_value = -{ - { - -1, - (gchar *) "Value", - (gchar *) "ay", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "value", - TRUE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_notifying = -{ - { - -1, - (gchar *) "Notifying", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "notifying", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_flags = -{ - { - -1, - (gchar *) "Flags", - (gchar *) "as", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "flags", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_descriptors = -{ - { - -1, - (gchar *) "Descriptors", - (gchar *) "ao", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "descriptors", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo * const _gatt_characteristic1_property_info_pointers[] = -{ - &_gatt_characteristic1_property_info_uuid, - &_gatt_characteristic1_property_info_service, - &_gatt_characteristic1_property_info_value, - &_gatt_characteristic1_property_info_notifying, - &_gatt_characteristic1_property_info_flags, - &_gatt_characteristic1_property_info_descriptors, - NULL -}; - -static const _ExtendedGDBusInterfaceInfo _gatt_characteristic1_interface_info = -{ - { - -1, - (gchar *) "org.bluez.GattCharacteristic1", - (GDBusMethodInfo **) &_gatt_characteristic1_method_info_pointers, - NULL, - (GDBusPropertyInfo **) &_gatt_characteristic1_property_info_pointers, - NULL - }, - "gatt-characteristic1", -}; - - -/** - * gatt_characteristic1_interface_info: - * - * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> D-Bus interface. - * - * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. - */ -GDBusInterfaceInfo * -gatt_characteristic1_interface_info (void) -{ - return (GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct; -} - -/** - * gatt_characteristic1_override_properties: - * @klass: The class structure for a #GObject<!-- -->-derived class. - * @property_id_begin: The property id to assign to the first overridden property. - * - * Overrides all #GObject properties in the #GattCharacteristic1 interface for a concrete class. - * The properties are overridden in the order they are defined. - * - * Returns: The last property id. - */ -guint -gatt_characteristic1_override_properties (GObjectClass *klass, guint property_id_begin) -{ - g_object_class_override_property (klass, property_id_begin++, "uuid"); - g_object_class_override_property (klass, property_id_begin++, "service"); - g_object_class_override_property (klass, property_id_begin++, "value"); - g_object_class_override_property (klass, property_id_begin++, "notifying"); - g_object_class_override_property (klass, property_id_begin++, "flags"); - g_object_class_override_property (klass, property_id_begin++, "descriptors"); - return property_id_begin - 1; -} - - - -/** - * GattCharacteristic1: - * - * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. - */ - -/** - * GattCharacteristic1Iface: - * @parent_iface: The parent interface. - * @handle_read_value: Handler for the #GattCharacteristic1::handle-read-value signal. - * @handle_start_notify: Handler for the #GattCharacteristic1::handle-start-notify signal. - * @handle_stop_notify: Handler for the #GattCharacteristic1::handle-stop-notify signal. - * @handle_write_value: Handler for the #GattCharacteristic1::handle-write-value signal. - * @get_descriptors: Getter for the #GattCharacteristic1:descriptors property. - * @get_flags: Getter for the #GattCharacteristic1:flags property. - * @get_notifying: Getter for the #GattCharacteristic1:notifying property. - * @get_service: Getter for the #GattCharacteristic1:service property. - * @get_uuid: Getter for the #GattCharacteristic1:uuid property. - * @get_value: Getter for the #GattCharacteristic1:value property. - * - * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. - */ - -typedef GattCharacteristic1Iface GattCharacteristic1Interface; -G_DEFINE_INTERFACE (GattCharacteristic1, gatt_characteristic1, G_TYPE_OBJECT); - -static void -gatt_characteristic1_default_init (GattCharacteristic1Iface *iface) -{ - /* GObject signals for incoming D-Bus method calls: */ - /** - * GattCharacteristic1::handle-read-value: - * @object: A #GattCharacteristic1. - * @invocation: A #GDBusMethodInvocation. - * @arg_options: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method. - * - * 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 gatt_characteristic1_complete_read_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-read-value", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_read_value), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); - - /** - * GattCharacteristic1::handle-write-value: - * @object: A #GattCharacteristic1. - * @invocation: A #GDBusMethodInvocation. - * @arg_value: Argument passed by remote caller. - * @arg_options: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method. - * - * 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 gatt_characteristic1_complete_write_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-write-value", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_write_value), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 3, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT); - - /** - * GattCharacteristic1::handle-start-notify: - * @object: A #GattCharacteristic1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method. - * - * 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 gatt_characteristic1_complete_start_notify() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-start-notify", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_start_notify), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /** - * GattCharacteristic1::handle-stop-notify: - * @object: A #GattCharacteristic1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method. - * - * 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 gatt_characteristic1_complete_stop_notify() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-stop-notify", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_stop_notify), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /* GObject properties for D-Bus properties: */ - /** - * GattCharacteristic1:uuid: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattCharacteristic1:service: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("service", "Service", "Service", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattCharacteristic1:value: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_variant ("value", "Value", "Value", G_VARIANT_TYPE ("ay"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattCharacteristic1:notifying: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Notifying">"Notifying"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("notifying", "Notifying", "Notifying", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattCharacteristic1:flags: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("flags", "Flags", "Flags", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattCharacteristic1:descriptors: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("descriptors", "Descriptors", "Descriptors", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -/** - * gatt_characteristic1_get_uuid: (skip) - * @object: A #GattCharacteristic1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_uuid() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_characteristic1_get_uuid (GattCharacteristic1 *object) -{ - return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_uuid (object); -} - -/** - * gatt_characteristic1_dup_uuid: (skip) - * @object: A #GattCharacteristic1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_characteristic1_dup_uuid (GattCharacteristic1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "uuid", &value, NULL); - return value; -} - -/** - * gatt_characteristic1_set_uuid: (skip) - * @object: A #GattCharacteristic1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_characteristic1_set_uuid (GattCharacteristic1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "uuid", value, NULL); -} - -/** - * gatt_characteristic1_get_service: (skip) - * @object: A #GattCharacteristic1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_service() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_characteristic1_get_service (GattCharacteristic1 *object) -{ - return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_service (object); -} - -/** - * gatt_characteristic1_dup_service: (skip) - * @object: A #GattCharacteristic1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_characteristic1_dup_service (GattCharacteristic1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "service", &value, NULL); - return value; -} - -/** - * gatt_characteristic1_set_service: (skip) - * @object: A #GattCharacteristic1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_characteristic1_set_service (GattCharacteristic1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "service", value, NULL); -} - -/** - * gatt_characteristic1_get_value: (skip) - * @object: A #GattCharacteristic1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_value() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -GVariant * -gatt_characteristic1_get_value (GattCharacteristic1 *object) -{ - return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_value (object); -} - -/** - * gatt_characteristic1_dup_value: (skip) - * @object: A #GattCharacteristic1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). - */ -GVariant * -gatt_characteristic1_dup_value (GattCharacteristic1 *object) -{ - GVariant *value; - g_object_get (G_OBJECT (object), "value", &value, NULL); - return value; -} - -/** - * gatt_characteristic1_set_value: (skip) - * @object: A #GattCharacteristic1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_characteristic1_set_value (GattCharacteristic1 *object, GVariant *value) -{ - g_object_set (G_OBJECT (object), "value", value, NULL); -} - -/** - * gatt_characteristic1_get_notifying: (skip) - * @object: A #GattCharacteristic1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Notifying">"Notifying"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -gatt_characteristic1_get_notifying (GattCharacteristic1 *object) -{ - return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_notifying (object); -} - -/** - * gatt_characteristic1_set_notifying: (skip) - * @object: A #GattCharacteristic1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Notifying">"Notifying"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_characteristic1_set_notifying (GattCharacteristic1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "notifying", value, NULL); -} - -/** - * gatt_characteristic1_get_flags: (skip) - * @object: A #GattCharacteristic1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_flags() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -gatt_characteristic1_get_flags (GattCharacteristic1 *object) -{ - return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_flags (object); -} - -/** - * gatt_characteristic1_dup_flags: (skip) - * @object: A #GattCharacteristic1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -gatt_characteristic1_dup_flags (GattCharacteristic1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "flags", &value, NULL); - return value; -} - -/** - * gatt_characteristic1_set_flags: (skip) - * @object: A #GattCharacteristic1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_characteristic1_set_flags (GattCharacteristic1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "flags", value, NULL); -} - -/** - * gatt_characteristic1_get_descriptors: (skip) - * @object: A #GattCharacteristic1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_descriptors() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -gatt_characteristic1_get_descriptors (GattCharacteristic1 *object) -{ - return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_descriptors (object); -} - -/** - * gatt_characteristic1_dup_descriptors: (skip) - * @object: A #GattCharacteristic1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -gatt_characteristic1_dup_descriptors (GattCharacteristic1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "descriptors", &value, NULL); - return value; -} - -/** - * gatt_characteristic1_set_descriptors: (skip) - * @object: A #GattCharacteristic1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_characteristic1_set_descriptors (GattCharacteristic1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "descriptors", value, NULL); -} - -/** - * gatt_characteristic1_call_read_value: - * @proxy: A #GattCharacteristic1Proxy. - * @arg_options: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method on @proxy. - * 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. - * You can then call gatt_characteristic1_call_read_value_finish() to get the result of the operation. - * - * See gatt_characteristic1_call_read_value_sync() for the synchronous, blocking version of this method. - */ -void -gatt_characteristic1_call_read_value ( - GattCharacteristic1 *proxy, - GVariant *arg_options, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "ReadValue", - g_variant_new ("(@a{sv})", - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * gatt_characteristic1_call_read_value_finish: - * @proxy: A #GattCharacteristic1Proxy. - * @out_value: (out): Return location for return parameter or %NULL to ignore. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_read_value(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with gatt_characteristic1_call_read_value(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_read_value_finish ( - GattCharacteristic1 *proxy, - GVariant **out_value, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "(@ay)", - out_value); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_read_value_sync: - * @proxy: A #GattCharacteristic1Proxy. - * @arg_options: Argument to pass with the method invocation. - * @out_value: (out): Return location for return parameter or %NULL to ignore. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See gatt_characteristic1_call_read_value() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_read_value_sync ( - GattCharacteristic1 *proxy, - GVariant *arg_options, - GVariant **out_value, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "ReadValue", - g_variant_new ("(@a{sv})", - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "(@ay)", - out_value); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_write_value: - * @proxy: A #GattCharacteristic1Proxy. - * @arg_value: Argument to pass with the method invocation. - * @arg_options: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method on @proxy. - * 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. - * You can then call gatt_characteristic1_call_write_value_finish() to get the result of the operation. - * - * See gatt_characteristic1_call_write_value_sync() for the synchronous, blocking version of this method. - */ -void -gatt_characteristic1_call_write_value ( - GattCharacteristic1 *proxy, - GVariant *arg_value, - GVariant *arg_options, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "WriteValue", - g_variant_new ("(@ay@a{sv})", - arg_value, - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * gatt_characteristic1_call_write_value_finish: - * @proxy: A #GattCharacteristic1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_write_value(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with gatt_characteristic1_call_write_value(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_write_value_finish ( - GattCharacteristic1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_write_value_sync: - * @proxy: A #GattCharacteristic1Proxy. - * @arg_value: Argument to pass with the method invocation. - * @arg_options: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See gatt_characteristic1_call_write_value() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_write_value_sync ( - GattCharacteristic1 *proxy, - GVariant *arg_value, - GVariant *arg_options, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "WriteValue", - g_variant_new ("(@ay@a{sv})", - arg_value, - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_start_notify: - * @proxy: A #GattCharacteristic1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method on @proxy. - * 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. - * You can then call gatt_characteristic1_call_start_notify_finish() to get the result of the operation. - * - * See gatt_characteristic1_call_start_notify_sync() for the synchronous, blocking version of this method. - */ -void -gatt_characteristic1_call_start_notify ( - GattCharacteristic1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "StartNotify", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * gatt_characteristic1_call_start_notify_finish: - * @proxy: A #GattCharacteristic1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_start_notify(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with gatt_characteristic1_call_start_notify(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_start_notify_finish ( - GattCharacteristic1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_start_notify_sync: - * @proxy: A #GattCharacteristic1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See gatt_characteristic1_call_start_notify() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_start_notify_sync ( - GattCharacteristic1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "StartNotify", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_stop_notify: - * @proxy: A #GattCharacteristic1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method on @proxy. - * 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. - * You can then call gatt_characteristic1_call_stop_notify_finish() to get the result of the operation. - * - * See gatt_characteristic1_call_stop_notify_sync() for the synchronous, blocking version of this method. - */ -void -gatt_characteristic1_call_stop_notify ( - GattCharacteristic1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "StopNotify", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * gatt_characteristic1_call_stop_notify_finish: - * @proxy: A #GattCharacteristic1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_stop_notify(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with gatt_characteristic1_call_stop_notify(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_stop_notify_finish ( - GattCharacteristic1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_call_stop_notify_sync: - * @proxy: A #GattCharacteristic1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See gatt_characteristic1_call_stop_notify() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_characteristic1_call_stop_notify_sync ( - GattCharacteristic1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "StopNotify", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_characteristic1_complete_read_value: - * @object: A #GattCharacteristic1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * @value: Parameter to return. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -gatt_characteristic1_complete_read_value ( - GattCharacteristic1 *object, - GDBusMethodInvocation *invocation, - GVariant *value) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("(@ay)", - value)); -} - -/** - * gatt_characteristic1_complete_write_value: - * @object: A #GattCharacteristic1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -gatt_characteristic1_complete_write_value ( - GattCharacteristic1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * gatt_characteristic1_complete_start_notify: - * @object: A #GattCharacteristic1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -gatt_characteristic1_complete_start_notify ( - GattCharacteristic1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/** - * gatt_characteristic1_complete_stop_notify: - * @object: A #GattCharacteristic1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -gatt_characteristic1_complete_stop_notify ( - GattCharacteristic1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/* ------------------------------------------------------------------------ */ - -/** - * GattCharacteristic1Proxy: - * - * The #GattCharacteristic1Proxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * GattCharacteristic1ProxyClass: - * @parent_class: The parent class. - * - * Class structure for #GattCharacteristic1Proxy. - */ - -struct _GattCharacteristic1ProxyPrivate -{ - GData *qdata; -}; - -static void gatt_characteristic1_proxy_iface_init (GattCharacteristic1Iface *iface); - -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Proxy, gatt_characteristic1_proxy, G_TYPE_DBUS_PROXY, - G_ADD_PRIVATE (GattCharacteristic1Proxy) - G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_proxy_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Proxy, gatt_characteristic1_proxy, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_proxy_iface_init)); - -#endif -static void -gatt_characteristic1_proxy_finalize (GObject *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - g_datalist_clear (&proxy->priv->qdata); - G_OBJECT_CLASS (gatt_characteristic1_proxy_parent_class)->finalize (object); -} - -static void -gatt_characteristic1_proxy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 6); - info = _gatt_characteristic1_property_info_pointers[prop_id - 1]; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); - if (info->use_gvariant) - { - g_value_set_variant (value, variant); - } - else - { - if (variant != NULL) - g_dbus_gvariant_to_gvalue (variant, value); - } - if (variant != NULL) - g_variant_unref (variant); -} - -static void -gatt_characteristic1_proxy_set_property_cb (GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - const _ExtendedGDBusPropertyInfo *info = user_data; - GError *error; - GVariant *_ret; - error = NULL; - _ret = g_dbus_proxy_call_finish (proxy, res, &error); - if (!_ret) - { - g_warning ("Error setting property '%s' on interface org.bluez.GattCharacteristic1: %s (%s, %d)", - info->parent_struct.name, - error->message, g_quark_to_string (error->domain), error->code); - g_error_free (error); - } - else - { - g_variant_unref (_ret); - } -} - -static void -gatt_characteristic1_proxy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 6); - info = _gatt_characteristic1_property_info_pointers[prop_id - 1]; - variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_dbus_proxy_call (G_DBUS_PROXY (object), - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", "org.bluez.GattCharacteristic1", info->parent_struct.name, variant), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, (GAsyncReadyCallback) gatt_characteristic1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); - g_variant_unref (variant); -} - -static void -gatt_characteristic1_proxy_g_signal (GDBusProxy *proxy, - const gchar *sender_name G_GNUC_UNUSED, - const gchar *signal_name, - GVariant *parameters) -{ - _ExtendedGDBusSignalInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint n; - guint signal_id; - info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, signal_name); - if (info == NULL) - return; - num_params = g_variant_n_children (parameters); - paramv = g_new0 (GValue, num_params + 1); - g_value_init (¶mv[0], TYPE_GATT_CHARACTERISTIC1); - g_value_set_object (¶mv[0], proxy); - g_variant_iter_init (&iter, parameters); - n = 1; - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_CHARACTERISTIC1); - g_signal_emitv (paramv, signal_id, 0, NULL); - for (n = 0; n < num_params + 1; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static void -gatt_characteristic1_proxy_g_properties_changed (GDBusProxy *_proxy, - GVariant *changed_properties, - const gchar *const *invalidated_properties) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (_proxy); - guint n; - const gchar *key; - GVariantIter *iter; - _ExtendedGDBusPropertyInfo *info; - g_variant_get (changed_properties, "a{sv}", &iter); - while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, key); - g_datalist_remove_data (&proxy->priv->qdata, key); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } - g_variant_iter_free (iter); - for (n = 0; invalidated_properties[n] != NULL; n++) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, invalidated_properties[n]); - g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } -} - -static const gchar * -gatt_characteristic1_proxy_get_uuid (GattCharacteristic1 *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUID"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -gatt_characteristic1_proxy_get_service (GattCharacteristic1 *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Service"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static GVariant * -gatt_characteristic1_proxy_get_value (GattCharacteristic1 *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - GVariant *variant; - GVariant *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Value"); - value = variant; - if (variant != NULL) - g_variant_unref (variant); - return value; -} - -static gboolean -gatt_characteristic1_proxy_get_notifying (GattCharacteristic1 *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Notifying"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static const gchar *const * -gatt_characteristic1_proxy_get_flags (GattCharacteristic1 *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - value = g_datalist_get_data (&proxy->priv->qdata, "Flags"); - if (value != NULL) - return value; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Flags"); - if (variant != NULL) - { - value = g_variant_get_strv (variant, NULL); - g_datalist_set_data_full (&proxy->priv->qdata, "Flags", (gpointer) value, g_free); - g_variant_unref (variant); - } - return value; -} - -static const gchar *const * -gatt_characteristic1_proxy_get_descriptors (GattCharacteristic1 *object) -{ - GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Descriptors"); - if (variant != NULL) - { - value = g_variant_get_objv (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static void -gatt_characteristic1_proxy_init (GattCharacteristic1Proxy *proxy) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - proxy->priv = gatt_characteristic1_proxy_get_instance_private (proxy); -#else - proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_GATT_CHARACTERISTIC1_PROXY, GattCharacteristic1ProxyPrivate); -#endif - - g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gatt_characteristic1_interface_info ()); -} - -static void -gatt_characteristic1_proxy_class_init (GattCharacteristic1ProxyClass *klass) -{ - GObjectClass *gobject_class; - GDBusProxyClass *proxy_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = gatt_characteristic1_proxy_finalize; - gobject_class->get_property = gatt_characteristic1_proxy_get_property; - gobject_class->set_property = gatt_characteristic1_proxy_set_property; - - proxy_class = G_DBUS_PROXY_CLASS (klass); - proxy_class->g_signal = gatt_characteristic1_proxy_g_signal; - proxy_class->g_properties_changed = gatt_characteristic1_proxy_g_properties_changed; - - gatt_characteristic1_override_properties (gobject_class, 1); - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (GattCharacteristic1ProxyPrivate)); -#endif -} - -static void -gatt_characteristic1_proxy_iface_init (GattCharacteristic1Iface *iface) -{ - iface->get_uuid = gatt_characteristic1_proxy_get_uuid; - iface->get_service = gatt_characteristic1_proxy_get_service; - iface->get_value = gatt_characteristic1_proxy_get_value; - iface->get_notifying = gatt_characteristic1_proxy_get_notifying; - iface->get_flags = gatt_characteristic1_proxy_get_flags; - iface->get_descriptors = gatt_characteristic1_proxy_get_descriptors; -} - -/** - * gatt_characteristic1_proxy_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. See g_dbus_proxy_new() for more details. - * - * 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. - * You can then call gatt_characteristic1_proxy_new_finish() to get the result of the operation. - * - * See gatt_characteristic1_proxy_new_sync() for the synchronous, blocking version of this constructor. - */ -void -gatt_characteristic1_proxy_new ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_GATT_CHARACTERISTIC1_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.GattCharacteristic1", NULL); -} - -/** - * gatt_characteristic1_proxy_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_proxy_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with gatt_characteristic1_proxy_new(). - * - * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattCharacteristic1 * -gatt_characteristic1_proxy_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return GATT_CHARACTERISTIC1 (ret); - else - return NULL; -} - -/** - * gatt_characteristic1_proxy_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. See g_dbus_proxy_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See gatt_characteristic1_proxy_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattCharacteristic1 * -gatt_characteristic1_proxy_new_sync ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_GATT_CHARACTERISTIC1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); - if (ret != NULL) - return GATT_CHARACTERISTIC1 (ret); - else - return NULL; -} - - -/** - * gatt_characteristic1_proxy_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like gatt_characteristic1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call gatt_characteristic1_proxy_new_for_bus_finish() to get the result of the operation. - * - * See gatt_characteristic1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -gatt_characteristic1_proxy_new_for_bus ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_GATT_CHARACTERISTIC1_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.GattCharacteristic1", NULL); -} - -/** - * gatt_characteristic1_proxy_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_proxy_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with gatt_characteristic1_proxy_new_for_bus(). - * - * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattCharacteristic1 * -gatt_characteristic1_proxy_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return GATT_CHARACTERISTIC1 (ret); - else - return NULL; -} - -/** - * gatt_characteristic1_proxy_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like gatt_characteristic1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See gatt_characteristic1_proxy_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattCharacteristic1 * -gatt_characteristic1_proxy_new_for_bus_sync ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_GATT_CHARACTERISTIC1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); - if (ret != NULL) - return GATT_CHARACTERISTIC1 (ret); - else - return NULL; -} - - -/* ------------------------------------------------------------------------ */ - -/** - * GattCharacteristic1Skeleton: - * - * The #GattCharacteristic1Skeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * GattCharacteristic1SkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #GattCharacteristic1Skeleton. - */ - -struct _GattCharacteristic1SkeletonPrivate -{ - GValue *properties; - GList *changed_properties; - GSource *changed_properties_idle_source; - GMainContext *context; - GMutex lock; -}; - -static void -_gatt_characteristic1_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) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); - _ExtendedGDBusMethodInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint num_extra; - guint n; - guint signal_id; - GValue return_value = G_VALUE_INIT; - info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); - g_assert (info != NULL); - num_params = g_variant_n_children (parameters); - num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); - n = 0; - g_value_init (¶mv[n], TYPE_GATT_CHARACTERISTIC1); - g_value_set_object (¶mv[n++], skeleton); - g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); - g_value_set_object (¶mv[n++], invocation); - if (info->pass_fdlist) - { -#ifdef G_OS_UNIX - g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); - g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); -#else - g_assert_not_reached (); -#endif - } - g_variant_iter_init (&iter, parameters); - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_CHARACTERISTIC1); - g_value_init (&return_value, G_TYPE_BOOLEAN); - g_signal_emitv (paramv, signal_id, 0, &return_value); - if (!g_value_get_boolean (&return_value)) - 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); - g_value_unset (&return_value); - for (n = 0; n < num_params + num_extra; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static GVariant * -_gatt_characteristic1_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) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - GVariant *ret; - ret = NULL; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - g_value_init (&value, pspec->value_type); - g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); - ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_value_unset (&value); - } - return ret; -} - -static gboolean -_gatt_characteristic1_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) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - gboolean ret; - ret = FALSE; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - if (info->use_gvariant) - g_value_set_variant (&value, variant); - else - g_dbus_gvariant_to_gvalue (variant, &value); - g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); - g_value_unset (&value); - ret = TRUE; - } - return ret; -} - -static const GDBusInterfaceVTable _gatt_characteristic1_skeleton_vtable = -{ - _gatt_characteristic1_skeleton_handle_method_call, - _gatt_characteristic1_skeleton_handle_get_property, - _gatt_characteristic1_skeleton_handle_set_property, - {NULL} -}; - -static GDBusInterfaceInfo * -gatt_characteristic1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return gatt_characteristic1_interface_info (); -} - -static GDBusInterfaceVTable * -gatt_characteristic1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return (GDBusInterfaceVTable *) &_gatt_characteristic1_skeleton_vtable; -} - -static GVariant * -gatt_characteristic1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (_skeleton); - - GVariantBuilder builder; - guint n; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - if (_gatt_characteristic1_interface_info.parent_struct.properties == NULL) - goto out; - for (n = 0; _gatt_characteristic1_interface_info.parent_struct.properties[n] != NULL; n++) - { - GDBusPropertyInfo *info = _gatt_characteristic1_interface_info.parent_struct.properties[n]; - if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) - { - GVariant *value; - value = _gatt_characteristic1_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.GattCharacteristic1", info->name, NULL, skeleton); - if (value != NULL) - { - g_variant_take_ref (value); - g_variant_builder_add (&builder, "{sv}", info->name, value); - g_variant_unref (value); - } - } - } -out: - return g_variant_builder_end (&builder); -} - -static gboolean _gatt_characteristic1_emit_changed (gpointer user_data); - -static void -gatt_characteristic1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (_skeleton); - gboolean emit_changed = FALSE; - - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties_idle_source != NULL) - { - g_source_destroy (skeleton->priv->changed_properties_idle_source); - skeleton->priv->changed_properties_idle_source = NULL; - emit_changed = TRUE; - } - g_mutex_unlock (&skeleton->priv->lock); - - if (emit_changed) - _gatt_characteristic1_emit_changed (skeleton); -} - -static void gatt_characteristic1_skeleton_iface_init (GattCharacteristic1Iface *iface); -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Skeleton, gatt_characteristic1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_ADD_PRIVATE (GattCharacteristic1Skeleton) - G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_skeleton_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Skeleton, gatt_characteristic1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_skeleton_iface_init)); - -#endif -static void -gatt_characteristic1_skeleton_finalize (GObject *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - guint n; - for (n = 0; n < 6; n++) - g_value_unset (&skeleton->priv->properties[n]); - g_free (skeleton->priv->properties); - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - if (skeleton->priv->changed_properties_idle_source != NULL) - g_source_destroy (skeleton->priv->changed_properties_idle_source); - g_main_context_unref (skeleton->priv->context); - g_mutex_clear (&skeleton->priv->lock); - G_OBJECT_CLASS (gatt_characteristic1_skeleton_parent_class)->finalize (object); -} - -static void -gatt_characteristic1_skeleton_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 6); - g_mutex_lock (&skeleton->priv->lock); - g_value_copy (&skeleton->priv->properties[prop_id - 1], value); - g_mutex_unlock (&skeleton->priv->lock); -} - -static gboolean -_gatt_characteristic1_emit_changed (gpointer user_data) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); - GList *l; - GVariantBuilder builder; - GVariantBuilder invalidated_builder; - guint num_changes; - - g_mutex_lock (&skeleton->priv->lock); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); - for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) - { - ChangedProperty *cp = l->data; - GVariant *variant; - const GValue *cur_value; - - cur_value = &skeleton->priv->properties[cp->prop_id - 1]; - if (!_g_value_equal (cur_value, &cp->orig_value)) - { - variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); - g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); - g_variant_unref (variant); - num_changes++; - } - } - if (num_changes > 0) - { - GList *connections, *ll; - GVariant *signal_variant; - signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.GattCharacteristic1", - &builder, &invalidated_builder)); - connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); - for (ll = connections; ll != NULL; ll = ll->next) - { - GDBusConnection *connection = ll->data; - - g_dbus_connection_emit_signal (connection, - NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - signal_variant, - NULL); - } - g_variant_unref (signal_variant); - g_list_free_full (connections, g_object_unref); - } - else - { - g_variant_builder_clear (&builder); - g_variant_builder_clear (&invalidated_builder); - } - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - skeleton->priv->changed_properties = NULL; - skeleton->priv->changed_properties_idle_source = NULL; - g_mutex_unlock (&skeleton->priv->lock); - return FALSE; -} - -static void -_gatt_characteristic1_schedule_emit_changed (GattCharacteristic1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) -{ - ChangedProperty *cp; - GList *l; - cp = NULL; - for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) - { - ChangedProperty *i_cp = l->data; - if (i_cp->info == info) - { - cp = i_cp; - break; - } - } - if (cp == NULL) - { - cp = g_new0 (ChangedProperty, 1); - cp->prop_id = prop_id; - cp->info = info; - skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); - g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); - g_value_copy (orig_value, &cp->orig_value); - } -} - -static void -gatt_characteristic1_skeleton_notify (GObject *object, - GParamSpec *pspec G_GNUC_UNUSED) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties != NULL && - skeleton->priv->changed_properties_idle_source == NULL) - { - skeleton->priv->changed_properties_idle_source = g_idle_source_new (); - g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); - g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gatt_characteristic1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); - g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gatt_characteristic1_emit_changed"); - g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); - g_source_unref (skeleton->priv->changed_properties_idle_source); - } - g_mutex_unlock (&skeleton->priv->lock); -} - -static void -gatt_characteristic1_skeleton_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 6); - g_mutex_lock (&skeleton->priv->lock); - g_object_freeze_notify (object); - if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) - { - if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) - _gatt_characteristic1_schedule_emit_changed (skeleton, _gatt_characteristic1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); - g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); - g_object_notify_by_pspec (object, pspec); - } - g_mutex_unlock (&skeleton->priv->lock); - g_object_thaw_notify (object); -} - -static void -gatt_characteristic1_skeleton_init (GattCharacteristic1Skeleton *skeleton) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - skeleton->priv = gatt_characteristic1_skeleton_get_instance_private (skeleton); -#else - skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_GATT_CHARACTERISTIC1_SKELETON, GattCharacteristic1SkeletonPrivate); -#endif - - g_mutex_init (&skeleton->priv->lock); - skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 6); - g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); - g_value_init (&skeleton->priv->properties[3], G_TYPE_BOOLEAN); - g_value_init (&skeleton->priv->properties[4], G_TYPE_STRV); - g_value_init (&skeleton->priv->properties[5], G_TYPE_STRV); -} - -static const gchar * -gatt_characteristic1_skeleton_get_uuid (GattCharacteristic1 *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[0])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -gatt_characteristic1_skeleton_get_service (GattCharacteristic1 *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[1])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static GVariant * -gatt_characteristic1_skeleton_get_value (GattCharacteristic1 *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - GVariant *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_variant (&(skeleton->priv->properties[2])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -gatt_characteristic1_skeleton_get_notifying (GattCharacteristic1 *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[3])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -gatt_characteristic1_skeleton_get_flags (GattCharacteristic1 *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[4])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -gatt_characteristic1_skeleton_get_descriptors (GattCharacteristic1 *object) -{ - GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[5])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static void -gatt_characteristic1_skeleton_class_init (GattCharacteristic1SkeletonClass *klass) -{ - GObjectClass *gobject_class; - GDBusInterfaceSkeletonClass *skeleton_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = gatt_characteristic1_skeleton_finalize; - gobject_class->get_property = gatt_characteristic1_skeleton_get_property; - gobject_class->set_property = gatt_characteristic1_skeleton_set_property; - gobject_class->notify = gatt_characteristic1_skeleton_notify; - - - gatt_characteristic1_override_properties (gobject_class, 1); - - skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); - skeleton_class->get_info = gatt_characteristic1_skeleton_dbus_interface_get_info; - skeleton_class->get_properties = gatt_characteristic1_skeleton_dbus_interface_get_properties; - skeleton_class->flush = gatt_characteristic1_skeleton_dbus_interface_flush; - skeleton_class->get_vtable = gatt_characteristic1_skeleton_dbus_interface_get_vtable; - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (GattCharacteristic1SkeletonPrivate)); -#endif -} - -static void -gatt_characteristic1_skeleton_iface_init (GattCharacteristic1Iface *iface) -{ - iface->get_uuid = gatt_characteristic1_skeleton_get_uuid; - iface->get_service = gatt_characteristic1_skeleton_get_service; - iface->get_value = gatt_characteristic1_skeleton_get_value; - iface->get_notifying = gatt_characteristic1_skeleton_get_notifying; - iface->get_flags = gatt_characteristic1_skeleton_get_flags; - iface->get_descriptors = gatt_characteristic1_skeleton_get_descriptors; -} - -/** - * gatt_characteristic1_skeleton_new: - * - * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. - * - * Returns: (transfer full) (type GattCharacteristic1Skeleton): The skeleton object. - */ -GattCharacteristic1 * -gatt_characteristic1_skeleton_new (void) -{ - return GATT_CHARACTERISTIC1 (g_object_new (TYPE_GATT_CHARACTERISTIC1_SKELETON, NULL)); -} - -/* ------------------------------------------------------------------------ - * Code for interface org.bluez.GattDescriptor1 - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:GattDescriptor1 - * @title: GattDescriptor1 - * @short_description: Generated C code for the org.bluez.GattDescriptor1 D-Bus interface - * - * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> D-Bus interface in C. - */ - -/* ---- Introspection data for org.bluez.GattDescriptor1 ---- */ - -static const _ExtendedGDBusArgInfo _gatt_descriptor1_method_info_read_value_IN_ARG_options = -{ - { - -1, - (gchar *) "options", - (gchar *) "a{sv}", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _gatt_descriptor1_method_info_read_value_IN_ARG_pointers[] = -{ - &_gatt_descriptor1_method_info_read_value_IN_ARG_options, - NULL -}; - -static const _ExtendedGDBusArgInfo _gatt_descriptor1_method_info_read_value_OUT_ARG_value = -{ - { - -1, - (gchar *) "value", - (gchar *) "ay", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _gatt_descriptor1_method_info_read_value_OUT_ARG_pointers[] = -{ - &_gatt_descriptor1_method_info_read_value_OUT_ARG_value, - NULL -}; - -static const _ExtendedGDBusMethodInfo _gatt_descriptor1_method_info_read_value = -{ - { - -1, - (gchar *) "ReadValue", - (GDBusArgInfo **) &_gatt_descriptor1_method_info_read_value_IN_ARG_pointers, - (GDBusArgInfo **) &_gatt_descriptor1_method_info_read_value_OUT_ARG_pointers, - NULL - }, - "handle-read-value", - FALSE -}; - -static const _ExtendedGDBusArgInfo _gatt_descriptor1_method_info_write_value_IN_ARG_value = -{ - { - -1, - (gchar *) "value", - (gchar *) "ay", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo _gatt_descriptor1_method_info_write_value_IN_ARG_options = -{ - { - -1, - (gchar *) "options", - (gchar *) "a{sv}", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _gatt_descriptor1_method_info_write_value_IN_ARG_pointers[] = -{ - &_gatt_descriptor1_method_info_write_value_IN_ARG_value, - &_gatt_descriptor1_method_info_write_value_IN_ARG_options, - NULL -}; - -static const _ExtendedGDBusMethodInfo _gatt_descriptor1_method_info_write_value = -{ - { - -1, - (gchar *) "WriteValue", - (GDBusArgInfo **) &_gatt_descriptor1_method_info_write_value_IN_ARG_pointers, - NULL, - NULL - }, - "handle-write-value", - FALSE -}; - -static const _ExtendedGDBusMethodInfo * const _gatt_descriptor1_method_info_pointers[] = -{ - &_gatt_descriptor1_method_info_read_value, - &_gatt_descriptor1_method_info_write_value, - NULL -}; - -static const _ExtendedGDBusPropertyInfo _gatt_descriptor1_property_info_uuid = -{ - { - -1, - (gchar *) "UUID", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "uuid", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_descriptor1_property_info_characteristic = -{ - { - -1, - (gchar *) "Characteristic", - (gchar *) "o", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "characteristic", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _gatt_descriptor1_property_info_value = -{ - { - -1, - (gchar *) "Value", - (gchar *) "ay", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "value", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo * const _gatt_descriptor1_property_info_pointers[] = -{ - &_gatt_descriptor1_property_info_uuid, - &_gatt_descriptor1_property_info_characteristic, - &_gatt_descriptor1_property_info_value, - NULL -}; - -static const _ExtendedGDBusInterfaceInfo _gatt_descriptor1_interface_info = -{ - { - -1, - (gchar *) "org.bluez.GattDescriptor1", - (GDBusMethodInfo **) &_gatt_descriptor1_method_info_pointers, - NULL, - (GDBusPropertyInfo **) &_gatt_descriptor1_property_info_pointers, - NULL - }, - "gatt-descriptor1", -}; - - -/** - * gatt_descriptor1_interface_info: - * - * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> D-Bus interface. - * - * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. - */ -GDBusInterfaceInfo * -gatt_descriptor1_interface_info (void) -{ - return (GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct; -} - -/** - * gatt_descriptor1_override_properties: - * @klass: The class structure for a #GObject<!-- -->-derived class. - * @property_id_begin: The property id to assign to the first overridden property. - * - * Overrides all #GObject properties in the #GattDescriptor1 interface for a concrete class. - * The properties are overridden in the order they are defined. - * - * Returns: The last property id. - */ -guint -gatt_descriptor1_override_properties (GObjectClass *klass, guint property_id_begin) -{ - g_object_class_override_property (klass, property_id_begin++, "uuid"); - g_object_class_override_property (klass, property_id_begin++, "characteristic"); - g_object_class_override_property (klass, property_id_begin++, "value"); - return property_id_begin - 1; -} - - - -/** - * GattDescriptor1: - * - * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. - */ - -/** - * GattDescriptor1Iface: - * @parent_iface: The parent interface. - * @handle_read_value: Handler for the #GattDescriptor1::handle-read-value signal. - * @handle_write_value: Handler for the #GattDescriptor1::handle-write-value signal. - * @get_characteristic: Getter for the #GattDescriptor1:characteristic property. - * @get_uuid: Getter for the #GattDescriptor1:uuid property. - * @get_value: Getter for the #GattDescriptor1:value property. - * - * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. - */ - -typedef GattDescriptor1Iface GattDescriptor1Interface; -G_DEFINE_INTERFACE (GattDescriptor1, gatt_descriptor1, G_TYPE_OBJECT); - -static void -gatt_descriptor1_default_init (GattDescriptor1Iface *iface) -{ - /* GObject signals for incoming D-Bus method calls: */ - /** - * GattDescriptor1::handle-read-value: - * @object: A #GattDescriptor1. - * @invocation: A #GDBusMethodInvocation. - * @arg_options: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method. - * - * 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 gatt_descriptor1_complete_read_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-read-value", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GattDescriptor1Iface, handle_read_value), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); - - /** - * GattDescriptor1::handle-write-value: - * @object: A #GattDescriptor1. - * @invocation: A #GDBusMethodInvocation. - * @arg_value: Argument passed by remote caller. - * @arg_options: Argument passed by remote caller. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method. - * - * 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 gatt_descriptor1_complete_write_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-write-value", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GattDescriptor1Iface, handle_write_value), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 3, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); - - /* GObject properties for D-Bus properties: */ - /** - * GattDescriptor1:uuid: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattDescriptor1:characteristic: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("characteristic", "Characteristic", "Characteristic", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * GattDescriptor1:value: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("value", "Value", "Value", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -/** - * gatt_descriptor1_get_uuid: (skip) - * @object: A #GattDescriptor1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_descriptor1_dup_uuid() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_descriptor1_get_uuid (GattDescriptor1 *object) -{ - return GATT_DESCRIPTOR1_GET_IFACE (object)->get_uuid (object); -} - -/** - * gatt_descriptor1_dup_uuid: (skip) - * @object: A #GattDescriptor1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_descriptor1_dup_uuid (GattDescriptor1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "uuid", &value, NULL); - return value; -} - -/** - * gatt_descriptor1_set_uuid: (skip) - * @object: A #GattDescriptor1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_descriptor1_set_uuid (GattDescriptor1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "uuid", value, NULL); -} - -/** - * gatt_descriptor1_get_characteristic: (skip) - * @object: A #GattDescriptor1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_descriptor1_dup_characteristic() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_descriptor1_get_characteristic (GattDescriptor1 *object) -{ - return GATT_DESCRIPTOR1_GET_IFACE (object)->get_characteristic (object); -} - -/** - * gatt_descriptor1_dup_characteristic: (skip) - * @object: A #GattDescriptor1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_descriptor1_dup_characteristic (GattDescriptor1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "characteristic", &value, NULL); - return value; -} - -/** - * gatt_descriptor1_set_characteristic: (skip) - * @object: A #GattDescriptor1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_descriptor1_set_characteristic (GattDescriptor1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "characteristic", value, NULL); -} - -/** - * gatt_descriptor1_get_value: (skip) - * @object: A #GattDescriptor1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_descriptor1_dup_value() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -gatt_descriptor1_get_value (GattDescriptor1 *object) -{ - return GATT_DESCRIPTOR1_GET_IFACE (object)->get_value (object); -} - -/** - * gatt_descriptor1_dup_value: (skip) - * @object: A #GattDescriptor1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -gatt_descriptor1_dup_value (GattDescriptor1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "value", &value, NULL); - return value; -} - -/** - * gatt_descriptor1_set_value: (skip) - * @object: A #GattDescriptor1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -gatt_descriptor1_set_value (GattDescriptor1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "value", value, NULL); -} - -/** - * gatt_descriptor1_call_read_value: - * @proxy: A #GattDescriptor1Proxy. - * @arg_options: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method on @proxy. - * 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. - * You can then call gatt_descriptor1_call_read_value_finish() to get the result of the operation. - * - * See gatt_descriptor1_call_read_value_sync() for the synchronous, blocking version of this method. - */ -void -gatt_descriptor1_call_read_value ( - GattDescriptor1 *proxy, - GVariant *arg_options, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "ReadValue", - g_variant_new ("(@a{sv})", - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * gatt_descriptor1_call_read_value_finish: - * @proxy: A #GattDescriptor1Proxy. - * @out_value: (out): Return location for return parameter or %NULL to ignore. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_call_read_value(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with gatt_descriptor1_call_read_value(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_descriptor1_call_read_value_finish ( - GattDescriptor1 *proxy, - gchar **out_value, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "(^ay)", - out_value); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_descriptor1_call_read_value_sync: - * @proxy: A #GattDescriptor1Proxy. - * @arg_options: Argument to pass with the method invocation. - * @out_value: (out): Return location for return parameter or %NULL to ignore. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See gatt_descriptor1_call_read_value() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_descriptor1_call_read_value_sync ( - GattDescriptor1 *proxy, - GVariant *arg_options, - gchar **out_value, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "ReadValue", - g_variant_new ("(@a{sv})", - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "(^ay)", - out_value); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_descriptor1_call_write_value: - * @proxy: A #GattDescriptor1Proxy. - * @arg_value: Argument to pass with the method invocation. - * @arg_options: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method on @proxy. - * 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. - * You can then call gatt_descriptor1_call_write_value_finish() to get the result of the operation. - * - * See gatt_descriptor1_call_write_value_sync() for the synchronous, blocking version of this method. - */ -void -gatt_descriptor1_call_write_value ( - GattDescriptor1 *proxy, - const gchar *arg_value, - GVariant *arg_options, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "WriteValue", - g_variant_new ("(^ay@a{sv})", - arg_value, - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * gatt_descriptor1_call_write_value_finish: - * @proxy: A #GattDescriptor1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_call_write_value(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with gatt_descriptor1_call_write_value(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_descriptor1_call_write_value_finish ( - GattDescriptor1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_descriptor1_call_write_value_sync: - * @proxy: A #GattDescriptor1Proxy. - * @arg_value: Argument to pass with the method invocation. - * @arg_options: Argument to pass with the method invocation. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See gatt_descriptor1_call_write_value() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -gatt_descriptor1_call_write_value_sync ( - GattDescriptor1 *proxy, - const gchar *arg_value, - GVariant *arg_options, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "WriteValue", - g_variant_new ("(^ay@a{sv})", - arg_value, - arg_options), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * gatt_descriptor1_complete_read_value: - * @object: A #GattDescriptor1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * @value: Parameter to return. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -gatt_descriptor1_complete_read_value ( - GattDescriptor1 *object, - GDBusMethodInvocation *invocation, - const gchar *value) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("(^ay)", - value)); -} - -/** - * gatt_descriptor1_complete_write_value: - * @object: A #GattDescriptor1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -gatt_descriptor1_complete_write_value ( - GattDescriptor1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/* ------------------------------------------------------------------------ */ - -/** - * GattDescriptor1Proxy: - * - * The #GattDescriptor1Proxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * GattDescriptor1ProxyClass: - * @parent_class: The parent class. - * - * Class structure for #GattDescriptor1Proxy. - */ - -struct _GattDescriptor1ProxyPrivate -{ - GData *qdata; -}; - -static void gatt_descriptor1_proxy_iface_init (GattDescriptor1Iface *iface); - -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Proxy, gatt_descriptor1_proxy, G_TYPE_DBUS_PROXY, - G_ADD_PRIVATE (GattDescriptor1Proxy) - G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_proxy_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Proxy, gatt_descriptor1_proxy, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_proxy_iface_init)); - -#endif -static void -gatt_descriptor1_proxy_finalize (GObject *object) -{ - GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); - g_datalist_clear (&proxy->priv->qdata); - G_OBJECT_CLASS (gatt_descriptor1_proxy_parent_class)->finalize (object); -} - -static void -gatt_descriptor1_proxy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 3); - info = _gatt_descriptor1_property_info_pointers[prop_id - 1]; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); - if (info->use_gvariant) - { - g_value_set_variant (value, variant); - } - else - { - if (variant != NULL) - g_dbus_gvariant_to_gvalue (variant, value); - } - if (variant != NULL) - g_variant_unref (variant); -} - -static void -gatt_descriptor1_proxy_set_property_cb (GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - const _ExtendedGDBusPropertyInfo *info = user_data; - GError *error; - GVariant *_ret; - error = NULL; - _ret = g_dbus_proxy_call_finish (proxy, res, &error); - if (!_ret) - { - g_warning ("Error setting property '%s' on interface org.bluez.GattDescriptor1: %s (%s, %d)", - info->parent_struct.name, - error->message, g_quark_to_string (error->domain), error->code); - g_error_free (error); - } - else - { - g_variant_unref (_ret); - } -} - -static void -gatt_descriptor1_proxy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 3); - info = _gatt_descriptor1_property_info_pointers[prop_id - 1]; - variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_dbus_proxy_call (G_DBUS_PROXY (object), - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", "org.bluez.GattDescriptor1", info->parent_struct.name, variant), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, (GAsyncReadyCallback) gatt_descriptor1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); - g_variant_unref (variant); -} - -static void -gatt_descriptor1_proxy_g_signal (GDBusProxy *proxy, - const gchar *sender_name G_GNUC_UNUSED, - const gchar *signal_name, - GVariant *parameters) -{ - _ExtendedGDBusSignalInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint n; - guint signal_id; - info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, signal_name); - if (info == NULL) - return; - num_params = g_variant_n_children (parameters); - paramv = g_new0 (GValue, num_params + 1); - g_value_init (¶mv[0], TYPE_GATT_DESCRIPTOR1); - g_value_set_object (¶mv[0], proxy); - g_variant_iter_init (&iter, parameters); - n = 1; - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_DESCRIPTOR1); - g_signal_emitv (paramv, signal_id, 0, NULL); - for (n = 0; n < num_params + 1; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static void -gatt_descriptor1_proxy_g_properties_changed (GDBusProxy *_proxy, - GVariant *changed_properties, - const gchar *const *invalidated_properties) -{ - GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (_proxy); - guint n; - const gchar *key; - GVariantIter *iter; - _ExtendedGDBusPropertyInfo *info; - g_variant_get (changed_properties, "a{sv}", &iter); - while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, key); - g_datalist_remove_data (&proxy->priv->qdata, key); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } - g_variant_iter_free (iter); - for (n = 0; invalidated_properties[n] != NULL; n++) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, invalidated_properties[n]); - g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } -} - -static const gchar * -gatt_descriptor1_proxy_get_uuid (GattDescriptor1 *object) -{ - GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUID"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -gatt_descriptor1_proxy_get_characteristic (GattDescriptor1 *object) -{ - GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Characteristic"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar * -gatt_descriptor1_proxy_get_value (GattDescriptor1 *object) -{ - GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Value"); - if (variant != NULL) - { - value = g_variant_get_bytestring (variant); - g_variant_unref (variant); - } - return value; -} - -static void -gatt_descriptor1_proxy_init (GattDescriptor1Proxy *proxy) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - proxy->priv = gatt_descriptor1_proxy_get_instance_private (proxy); -#else - proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_GATT_DESCRIPTOR1_PROXY, GattDescriptor1ProxyPrivate); -#endif - - g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gatt_descriptor1_interface_info ()); -} - -static void -gatt_descriptor1_proxy_class_init (GattDescriptor1ProxyClass *klass) -{ - GObjectClass *gobject_class; - GDBusProxyClass *proxy_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = gatt_descriptor1_proxy_finalize; - gobject_class->get_property = gatt_descriptor1_proxy_get_property; - gobject_class->set_property = gatt_descriptor1_proxy_set_property; - - proxy_class = G_DBUS_PROXY_CLASS (klass); - proxy_class->g_signal = gatt_descriptor1_proxy_g_signal; - proxy_class->g_properties_changed = gatt_descriptor1_proxy_g_properties_changed; - - gatt_descriptor1_override_properties (gobject_class, 1); - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (GattDescriptor1ProxyPrivate)); -#endif -} - -static void -gatt_descriptor1_proxy_iface_init (GattDescriptor1Iface *iface) -{ - iface->get_uuid = gatt_descriptor1_proxy_get_uuid; - iface->get_characteristic = gatt_descriptor1_proxy_get_characteristic; - iface->get_value = gatt_descriptor1_proxy_get_value; -} - -/** - * gatt_descriptor1_proxy_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. See g_dbus_proxy_new() for more details. - * - * 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. - * You can then call gatt_descriptor1_proxy_new_finish() to get the result of the operation. - * - * See gatt_descriptor1_proxy_new_sync() for the synchronous, blocking version of this constructor. - */ -void -gatt_descriptor1_proxy_new ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_GATT_DESCRIPTOR1_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.GattDescriptor1", NULL); -} - -/** - * gatt_descriptor1_proxy_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_proxy_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with gatt_descriptor1_proxy_new(). - * - * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattDescriptor1 * -gatt_descriptor1_proxy_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return GATT_DESCRIPTOR1 (ret); - else - return NULL; -} - -/** - * gatt_descriptor1_proxy_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. See g_dbus_proxy_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See gatt_descriptor1_proxy_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattDescriptor1 * -gatt_descriptor1_proxy_new_sync ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_GATT_DESCRIPTOR1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); - if (ret != NULL) - return GATT_DESCRIPTOR1 (ret); - else - return NULL; -} - - -/** - * gatt_descriptor1_proxy_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like gatt_descriptor1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call gatt_descriptor1_proxy_new_for_bus_finish() to get the result of the operation. - * - * See gatt_descriptor1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -gatt_descriptor1_proxy_new_for_bus ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_GATT_DESCRIPTOR1_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.GattDescriptor1", NULL); -} - -/** - * gatt_descriptor1_proxy_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_proxy_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with gatt_descriptor1_proxy_new_for_bus(). - * - * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattDescriptor1 * -gatt_descriptor1_proxy_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return GATT_DESCRIPTOR1 (ret); - else - return NULL; -} - -/** - * gatt_descriptor1_proxy_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like gatt_descriptor1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See gatt_descriptor1_proxy_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. - */ -GattDescriptor1 * -gatt_descriptor1_proxy_new_for_bus_sync ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_GATT_DESCRIPTOR1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); - if (ret != NULL) - return GATT_DESCRIPTOR1 (ret); - else - return NULL; -} - - -/* ------------------------------------------------------------------------ */ - -/** - * GattDescriptor1Skeleton: - * - * The #GattDescriptor1Skeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * GattDescriptor1SkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #GattDescriptor1Skeleton. - */ - -struct _GattDescriptor1SkeletonPrivate -{ - GValue *properties; - GList *changed_properties; - GSource *changed_properties_idle_source; - GMainContext *context; - GMutex lock; -}; - -static void -_gatt_descriptor1_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) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); - _ExtendedGDBusMethodInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint num_extra; - guint n; - guint signal_id; - GValue return_value = G_VALUE_INIT; - info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); - g_assert (info != NULL); - num_params = g_variant_n_children (parameters); - num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); - n = 0; - g_value_init (¶mv[n], TYPE_GATT_DESCRIPTOR1); - g_value_set_object (¶mv[n++], skeleton); - g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); - g_value_set_object (¶mv[n++], invocation); - if (info->pass_fdlist) - { -#ifdef G_OS_UNIX - g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); - g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); -#else - g_assert_not_reached (); -#endif - } - g_variant_iter_init (&iter, parameters); - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_DESCRIPTOR1); - g_value_init (&return_value, G_TYPE_BOOLEAN); - g_signal_emitv (paramv, signal_id, 0, &return_value); - if (!g_value_get_boolean (&return_value)) - 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); - g_value_unset (&return_value); - for (n = 0; n < num_params + num_extra; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static GVariant * -_gatt_descriptor1_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) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - GVariant *ret; - ret = NULL; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - g_value_init (&value, pspec->value_type); - g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); - ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_value_unset (&value); - } - return ret; -} - -static gboolean -_gatt_descriptor1_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) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - gboolean ret; - ret = FALSE; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - if (info->use_gvariant) - g_value_set_variant (&value, variant); - else - g_dbus_gvariant_to_gvalue (variant, &value); - g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); - g_value_unset (&value); - ret = TRUE; - } - return ret; -} - -static const GDBusInterfaceVTable _gatt_descriptor1_skeleton_vtable = -{ - _gatt_descriptor1_skeleton_handle_method_call, - _gatt_descriptor1_skeleton_handle_get_property, - _gatt_descriptor1_skeleton_handle_set_property, - {NULL} -}; - -static GDBusInterfaceInfo * -gatt_descriptor1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return gatt_descriptor1_interface_info (); -} - -static GDBusInterfaceVTable * -gatt_descriptor1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return (GDBusInterfaceVTable *) &_gatt_descriptor1_skeleton_vtable; -} - -static GVariant * -gatt_descriptor1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (_skeleton); - - GVariantBuilder builder; - guint n; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - if (_gatt_descriptor1_interface_info.parent_struct.properties == NULL) - goto out; - for (n = 0; _gatt_descriptor1_interface_info.parent_struct.properties[n] != NULL; n++) - { - GDBusPropertyInfo *info = _gatt_descriptor1_interface_info.parent_struct.properties[n]; - if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) - { - GVariant *value; - value = _gatt_descriptor1_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.GattDescriptor1", info->name, NULL, skeleton); - if (value != NULL) - { - g_variant_take_ref (value); - g_variant_builder_add (&builder, "{sv}", info->name, value); - g_variant_unref (value); - } - } - } -out: - return g_variant_builder_end (&builder); -} - -static gboolean _gatt_descriptor1_emit_changed (gpointer user_data); - -static void -gatt_descriptor1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (_skeleton); - gboolean emit_changed = FALSE; - - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties_idle_source != NULL) - { - g_source_destroy (skeleton->priv->changed_properties_idle_source); - skeleton->priv->changed_properties_idle_source = NULL; - emit_changed = TRUE; - } - g_mutex_unlock (&skeleton->priv->lock); - - if (emit_changed) - _gatt_descriptor1_emit_changed (skeleton); -} - -static void gatt_descriptor1_skeleton_iface_init (GattDescriptor1Iface *iface); -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Skeleton, gatt_descriptor1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_ADD_PRIVATE (GattDescriptor1Skeleton) - G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_skeleton_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Skeleton, gatt_descriptor1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_skeleton_iface_init)); - -#endif -static void -gatt_descriptor1_skeleton_finalize (GObject *object) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - guint n; - for (n = 0; n < 3; n++) - g_value_unset (&skeleton->priv->properties[n]); - g_free (skeleton->priv->properties); - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - if (skeleton->priv->changed_properties_idle_source != NULL) - g_source_destroy (skeleton->priv->changed_properties_idle_source); - g_main_context_unref (skeleton->priv->context); - g_mutex_clear (&skeleton->priv->lock); - G_OBJECT_CLASS (gatt_descriptor1_skeleton_parent_class)->finalize (object); -} - -static void -gatt_descriptor1_skeleton_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 3); - g_mutex_lock (&skeleton->priv->lock); - g_value_copy (&skeleton->priv->properties[prop_id - 1], value); - g_mutex_unlock (&skeleton->priv->lock); -} - -static gboolean -_gatt_descriptor1_emit_changed (gpointer user_data) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); - GList *l; - GVariantBuilder builder; - GVariantBuilder invalidated_builder; - guint num_changes; - - g_mutex_lock (&skeleton->priv->lock); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); - for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) - { - ChangedProperty *cp = l->data; - GVariant *variant; - const GValue *cur_value; - - cur_value = &skeleton->priv->properties[cp->prop_id - 1]; - if (!_g_value_equal (cur_value, &cp->orig_value)) - { - variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); - g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); - g_variant_unref (variant); - num_changes++; - } - } - if (num_changes > 0) - { - GList *connections, *ll; - GVariant *signal_variant; - signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.GattDescriptor1", - &builder, &invalidated_builder)); - connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); - for (ll = connections; ll != NULL; ll = ll->next) - { - GDBusConnection *connection = ll->data; - - g_dbus_connection_emit_signal (connection, - NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - signal_variant, - NULL); - } - g_variant_unref (signal_variant); - g_list_free_full (connections, g_object_unref); - } - else - { - g_variant_builder_clear (&builder); - g_variant_builder_clear (&invalidated_builder); - } - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - skeleton->priv->changed_properties = NULL; - skeleton->priv->changed_properties_idle_source = NULL; - g_mutex_unlock (&skeleton->priv->lock); - return FALSE; -} - -static void -_gatt_descriptor1_schedule_emit_changed (GattDescriptor1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) -{ - ChangedProperty *cp; - GList *l; - cp = NULL; - for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) - { - ChangedProperty *i_cp = l->data; - if (i_cp->info == info) - { - cp = i_cp; - break; - } - } - if (cp == NULL) - { - cp = g_new0 (ChangedProperty, 1); - cp->prop_id = prop_id; - cp->info = info; - skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); - g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); - g_value_copy (orig_value, &cp->orig_value); - } -} - -static void -gatt_descriptor1_skeleton_notify (GObject *object, - GParamSpec *pspec G_GNUC_UNUSED) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties != NULL && - skeleton->priv->changed_properties_idle_source == NULL) - { - skeleton->priv->changed_properties_idle_source = g_idle_source_new (); - g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); - g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gatt_descriptor1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); - g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gatt_descriptor1_emit_changed"); - g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); - g_source_unref (skeleton->priv->changed_properties_idle_source); - } - g_mutex_unlock (&skeleton->priv->lock); -} - -static void -gatt_descriptor1_skeleton_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 3); - g_mutex_lock (&skeleton->priv->lock); - g_object_freeze_notify (object); - if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) - { - if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) - _gatt_descriptor1_schedule_emit_changed (skeleton, _gatt_descriptor1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); - g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); - g_object_notify_by_pspec (object, pspec); - } - g_mutex_unlock (&skeleton->priv->lock); - g_object_thaw_notify (object); -} - -static void -gatt_descriptor1_skeleton_init (GattDescriptor1Skeleton *skeleton) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - skeleton->priv = gatt_descriptor1_skeleton_get_instance_private (skeleton); -#else - skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_GATT_DESCRIPTOR1_SKELETON, GattDescriptor1SkeletonPrivate); -#endif - - g_mutex_init (&skeleton->priv->lock); - skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 3); - g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); -} - -static const gchar * -gatt_descriptor1_skeleton_get_uuid (GattDescriptor1 *object) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[0])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -gatt_descriptor1_skeleton_get_characteristic (GattDescriptor1 *object) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[1])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar * -gatt_descriptor1_skeleton_get_value (GattDescriptor1 *object) -{ - GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[2])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static void -gatt_descriptor1_skeleton_class_init (GattDescriptor1SkeletonClass *klass) -{ - GObjectClass *gobject_class; - GDBusInterfaceSkeletonClass *skeleton_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = gatt_descriptor1_skeleton_finalize; - gobject_class->get_property = gatt_descriptor1_skeleton_get_property; - gobject_class->set_property = gatt_descriptor1_skeleton_set_property; - gobject_class->notify = gatt_descriptor1_skeleton_notify; - - - gatt_descriptor1_override_properties (gobject_class, 1); - - skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); - skeleton_class->get_info = gatt_descriptor1_skeleton_dbus_interface_get_info; - skeleton_class->get_properties = gatt_descriptor1_skeleton_dbus_interface_get_properties; - skeleton_class->flush = gatt_descriptor1_skeleton_dbus_interface_flush; - skeleton_class->get_vtable = gatt_descriptor1_skeleton_dbus_interface_get_vtable; - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (GattDescriptor1SkeletonPrivate)); -#endif -} - -static void -gatt_descriptor1_skeleton_iface_init (GattDescriptor1Iface *iface) -{ - iface->get_uuid = gatt_descriptor1_skeleton_get_uuid; - iface->get_characteristic = gatt_descriptor1_skeleton_get_characteristic; - iface->get_value = gatt_descriptor1_skeleton_get_value; -} - -/** - * gatt_descriptor1_skeleton_new: - * - * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. - * - * Returns: (transfer full) (type GattDescriptor1Skeleton): The skeleton object. - */ -GattDescriptor1 * -gatt_descriptor1_skeleton_new (void) -{ - return GATT_DESCRIPTOR1 (g_object_new (TYPE_GATT_DESCRIPTOR1_SKELETON, NULL)); -} - -/* ------------------------------------------------------------------------ - * Code for interface org.bluez.LEAdvertisement1 - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:LEAdvertisement1 - * @title: LEAdvertisement1 - * @short_description: Generated C code for the org.bluez.LEAdvertisement1 D-Bus interface - * - * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link> D-Bus interface in C. - */ - -/* ---- Introspection data for org.bluez.LEAdvertisement1 ---- */ - -static const GDBusAnnotationInfo _leadvertisement1_method_release_annotation_info_0 = -{ - -1, - (gchar *) "org.freedesktop.DBus.Method.NoReply", - (gchar *) "true", - NULL -}; - -static const GDBusAnnotationInfo * const _leadvertisement1_method_release_annotation_info_pointers[] = -{ - &_leadvertisement1_method_release_annotation_info_0, - NULL -}; - -static const _ExtendedGDBusMethodInfo _leadvertisement1_method_info_release = -{ - { - -1, - (gchar *) "Release", - NULL, - NULL, - (GDBusAnnotationInfo **) &_leadvertisement1_method_release_annotation_info_pointers - }, - "handle-release", - FALSE -}; - -static const _ExtendedGDBusMethodInfo * const _leadvertisement1_method_info_pointers[] = -{ - &_leadvertisement1_method_info_release, - NULL -}; - -static const _ExtendedGDBusPropertyInfo _leadvertisement1_property_info_type_ = -{ - { - -1, - (gchar *) "Type", - (gchar *) "s", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "type", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _leadvertisement1_property_info_service_uuids = -{ - { - -1, - (gchar *) "ServiceUUIDs", - (gchar *) "as", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "service-uuids", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _leadvertisement1_property_info_manufacturer_data = -{ - { - -1, - (gchar *) "ManufacturerData", - (gchar *) "a{sv}", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "manufacturer-data", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _leadvertisement1_property_info_solicit_uuids = -{ - { - -1, - (gchar *) "SolicitUUIDs", - (gchar *) "as", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "solicit-uuids", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _leadvertisement1_property_info_service_data = -{ - { - -1, - (gchar *) "ServiceData", - (gchar *) "a{sv}", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "service-data", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo _leadvertisement1_property_info_include_tx_power = -{ - { - -1, - (gchar *) "IncludeTxPower", - (gchar *) "b", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, - NULL - }, - "include-tx-power", - FALSE -}; - -static const _ExtendedGDBusPropertyInfo * const _leadvertisement1_property_info_pointers[] = -{ - &_leadvertisement1_property_info_type_, - &_leadvertisement1_property_info_service_uuids, - &_leadvertisement1_property_info_manufacturer_data, - &_leadvertisement1_property_info_solicit_uuids, - &_leadvertisement1_property_info_service_data, - &_leadvertisement1_property_info_include_tx_power, - NULL -}; - -static const GDBusAnnotationInfo _leadvertisement1_annotation_info_0 = -{ - -1, - (gchar *) "org.freedesktop.DBus.Properties.PropertiesChanged", - (gchar *) "const", - NULL -}; - -static const GDBusAnnotationInfo * const _leadvertisement1_annotation_info_pointers[] = -{ - &_leadvertisement1_annotation_info_0, - NULL -}; - -static const _ExtendedGDBusInterfaceInfo _leadvertisement1_interface_info = -{ - { - -1, - (gchar *) "org.bluez.LEAdvertisement1", - (GDBusMethodInfo **) &_leadvertisement1_method_info_pointers, - NULL, - (GDBusPropertyInfo **) &_leadvertisement1_property_info_pointers, - (GDBusAnnotationInfo **) &_leadvertisement1_annotation_info_pointers - }, - "leadvertisement1", -}; - - -/** - * leadvertisement1_interface_info: - * - * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link> D-Bus interface. - * - * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. - */ -GDBusInterfaceInfo * -leadvertisement1_interface_info (void) -{ - return (GDBusInterfaceInfo *) &_leadvertisement1_interface_info.parent_struct; -} - -/** - * leadvertisement1_override_properties: - * @klass: The class structure for a #GObject<!-- -->-derived class. - * @property_id_begin: The property id to assign to the first overridden property. - * - * Overrides all #GObject properties in the #LEAdvertisement1 interface for a concrete class. - * The properties are overridden in the order they are defined. - * - * Returns: The last property id. - */ -guint -leadvertisement1_override_properties (GObjectClass *klass, guint property_id_begin) -{ - g_object_class_override_property (klass, property_id_begin++, "type"); - g_object_class_override_property (klass, property_id_begin++, "service-uuids"); - g_object_class_override_property (klass, property_id_begin++, "manufacturer-data"); - g_object_class_override_property (klass, property_id_begin++, "solicit-uuids"); - g_object_class_override_property (klass, property_id_begin++, "service-data"); - g_object_class_override_property (klass, property_id_begin++, "include-tx-power"); - return property_id_begin - 1; -} - - - -/** - * LEAdvertisement1: - * - * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link>. - */ - -/** - * LEAdvertisement1Iface: - * @parent_iface: The parent interface. - * @handle_release: Handler for the #LEAdvertisement1::handle-release signal. - * @get_include_tx_power: Getter for the #LEAdvertisement1:include-tx-power property. - * @get_manufacturer_data: Getter for the #LEAdvertisement1:manufacturer-data property. - * @get_service_data: Getter for the #LEAdvertisement1:service-data property. - * @get_service_uuids: Getter for the #LEAdvertisement1:service-uuids property. - * @get_solicit_uuids: Getter for the #LEAdvertisement1:solicit-uuids property. - * @get_type_: Getter for the #LEAdvertisement1:type property. - * - * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link>. - */ - -typedef LEAdvertisement1Iface LEAdvertisement1Interface; -G_DEFINE_INTERFACE (LEAdvertisement1, leadvertisement1, G_TYPE_OBJECT); - -static void -leadvertisement1_default_init (LEAdvertisement1Iface *iface) -{ - /* GObject signals for incoming D-Bus method calls: */ - /** - * LEAdvertisement1::handle-release: - * @object: A #LEAdvertisement1. - * @invocation: A #GDBusMethodInvocation. - * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-LEAdvertisement1.Release">Release()</link> D-Bus method. - * - * 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 leadvertisement1_complete_release() 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. - * - * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. - */ - g_signal_new ("handle-release", - G_TYPE_FROM_INTERFACE (iface), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (LEAdvertisement1Iface, handle_release), - g_signal_accumulator_true_handled, - NULL, - g_cclosure_marshal_generic, - G_TYPE_BOOLEAN, - 1, - G_TYPE_DBUS_METHOD_INVOCATION); - - /* GObject properties for D-Bus properties: */ - /** - * LEAdvertisement1:type: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-LEAdvertisement1.Type">"Type"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_string ("type", "Type", "Type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * LEAdvertisement1:service-uuids: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceUUIDs">"ServiceUUIDs"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("service-uuids", "ServiceUUIDs", "ServiceUUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * LEAdvertisement1:manufacturer-data: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ManufacturerData">"ManufacturerData"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_variant ("manufacturer-data", "ManufacturerData", "ManufacturerData", G_VARIANT_TYPE ("a{sv}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * LEAdvertisement1:solicit-uuids: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-LEAdvertisement1.SolicitUUIDs">"SolicitUUIDs"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boxed ("solicit-uuids", "SolicitUUIDs", "SolicitUUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * LEAdvertisement1:service-data: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceData">"ServiceData"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_variant ("service-data", "ServiceData", "ServiceData", G_VARIANT_TYPE ("a{sv}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - * LEAdvertisement1:include-tx-power: - * - * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-LEAdvertisement1.IncludeTxPower">"IncludeTxPower"</link>. - * - * 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. - */ - g_object_interface_install_property (iface, - g_param_spec_boolean ("include-tx-power", "IncludeTxPower", "IncludeTxPower", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -/** - * leadvertisement1_get_type_: (skip) - * @object: A #LEAdvertisement1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.Type">"Type"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use leadvertisement1_dup_type_() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar * -leadvertisement1_get_type_ (LEAdvertisement1 *object) -{ - return LEADVERTISEMENT1_GET_IFACE (object)->get_type_ (object); -} - -/** - * leadvertisement1_dup_type_: (skip) - * @object: A #LEAdvertisement1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.Type">"Type"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). - */ -gchar * -leadvertisement1_dup_type_ (LEAdvertisement1 *object) -{ - gchar *value; - g_object_get (G_OBJECT (object), "type", &value, NULL); - return value; -} - -/** - * leadvertisement1_set_type_: (skip) - * @object: A #LEAdvertisement1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.Type">"Type"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -leadvertisement1_set_type_ (LEAdvertisement1 *object, const gchar *value) -{ - g_object_set (G_OBJECT (object), "type", value, NULL); -} - -/** - * leadvertisement1_get_service_uuids: (skip) - * @object: A #LEAdvertisement1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceUUIDs">"ServiceUUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use leadvertisement1_dup_service_uuids() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -leadvertisement1_get_service_uuids (LEAdvertisement1 *object) -{ - return LEADVERTISEMENT1_GET_IFACE (object)->get_service_uuids (object); -} - -/** - * leadvertisement1_dup_service_uuids: (skip) - * @object: A #LEAdvertisement1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceUUIDs">"ServiceUUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -leadvertisement1_dup_service_uuids (LEAdvertisement1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "service-uuids", &value, NULL); - return value; -} - -/** - * leadvertisement1_set_service_uuids: (skip) - * @object: A #LEAdvertisement1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceUUIDs">"ServiceUUIDs"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -leadvertisement1_set_service_uuids (LEAdvertisement1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "service-uuids", value, NULL); -} - -/** - * leadvertisement1_get_manufacturer_data: (skip) - * @object: A #LEAdvertisement1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ManufacturerData">"ManufacturerData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use leadvertisement1_dup_manufacturer_data() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -GVariant * -leadvertisement1_get_manufacturer_data (LEAdvertisement1 *object) -{ - return LEADVERTISEMENT1_GET_IFACE (object)->get_manufacturer_data (object); -} - -/** - * leadvertisement1_dup_manufacturer_data: (skip) - * @object: A #LEAdvertisement1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ManufacturerData">"ManufacturerData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). - */ -GVariant * -leadvertisement1_dup_manufacturer_data (LEAdvertisement1 *object) -{ - GVariant *value; - g_object_get (G_OBJECT (object), "manufacturer-data", &value, NULL); - return value; -} - -/** - * leadvertisement1_set_manufacturer_data: (skip) - * @object: A #LEAdvertisement1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ManufacturerData">"ManufacturerData"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -leadvertisement1_set_manufacturer_data (LEAdvertisement1 *object, GVariant *value) -{ - g_object_set (G_OBJECT (object), "manufacturer-data", value, NULL); -} - -/** - * leadvertisement1_get_solicit_uuids: (skip) - * @object: A #LEAdvertisement1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.SolicitUUIDs">"SolicitUUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use leadvertisement1_dup_solicit_uuids() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -const gchar *const * -leadvertisement1_get_solicit_uuids (LEAdvertisement1 *object) -{ - return LEADVERTISEMENT1_GET_IFACE (object)->get_solicit_uuids (object); -} - -/** - * leadvertisement1_dup_solicit_uuids: (skip) - * @object: A #LEAdvertisement1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.SolicitUUIDs">"SolicitUUIDs"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). - */ -gchar ** -leadvertisement1_dup_solicit_uuids (LEAdvertisement1 *object) -{ - gchar **value; - g_object_get (G_OBJECT (object), "solicit-uuids", &value, NULL); - return value; -} - -/** - * leadvertisement1_set_solicit_uuids: (skip) - * @object: A #LEAdvertisement1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.SolicitUUIDs">"SolicitUUIDs"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -leadvertisement1_set_solicit_uuids (LEAdvertisement1 *object, const gchar *const *value) -{ - g_object_set (G_OBJECT (object), "solicit-uuids", value, NULL); -} - -/** - * leadvertisement1_get_service_data: (skip) - * @object: A #LEAdvertisement1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceData">"ServiceData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use leadvertisement1_dup_service_data() if on another thread.</warning> - * - * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. - */ -GVariant * -leadvertisement1_get_service_data (LEAdvertisement1 *object) -{ - return LEADVERTISEMENT1_GET_IFACE (object)->get_service_data (object); -} - -/** - * leadvertisement1_dup_service_data: (skip) - * @object: A #LEAdvertisement1. - * - * Gets a copy of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceData">"ServiceData"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). - */ -GVariant * -leadvertisement1_dup_service_data (LEAdvertisement1 *object) -{ - GVariant *value; - g_object_get (G_OBJECT (object), "service-data", &value, NULL); - return value; -} - -/** - * leadvertisement1_set_service_data: (skip) - * @object: A #LEAdvertisement1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.ServiceData">"ServiceData"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -leadvertisement1_set_service_data (LEAdvertisement1 *object, GVariant *value) -{ - g_object_set (G_OBJECT (object), "service-data", value, NULL); -} - -/** - * leadvertisement1_get_include_tx_power: (skip) - * @object: A #LEAdvertisement1. - * - * Gets the value of the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.IncludeTxPower">"IncludeTxPower"</link> D-Bus property. - * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. - * - * Returns: The property value. - */ -gboolean -leadvertisement1_get_include_tx_power (LEAdvertisement1 *object) -{ - return LEADVERTISEMENT1_GET_IFACE (object)->get_include_tx_power (object); -} - -/** - * leadvertisement1_set_include_tx_power: (skip) - * @object: A #LEAdvertisement1. - * @value: The value to set. - * - * Sets the <link linkend="gdbus-property-org-bluez-LEAdvertisement1.IncludeTxPower">"IncludeTxPower"</link> D-Bus property to @value. - * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. - */ -void -leadvertisement1_set_include_tx_power (LEAdvertisement1 *object, gboolean value) -{ - g_object_set (G_OBJECT (object), "include-tx-power", value, NULL); -} - -/** - * leadvertisement1_call_release: - * @proxy: A #LEAdvertisement1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. - * @user_data: User data to pass to @callback. - * - * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-LEAdvertisement1.Release">Release()</link> D-Bus method on @proxy. - * 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. - * You can then call leadvertisement1_call_release_finish() to get the result of the operation. - * - * See leadvertisement1_call_release_sync() for the synchronous, blocking version of this method. - */ -void -leadvertisement1_call_release ( - LEAdvertisement1 *proxy, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "Release", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - callback, - user_data); -} - -/** - * leadvertisement1_call_release_finish: - * @proxy: A #LEAdvertisement1Proxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to leadvertisement1_call_release(). - * @error: Return location for error or %NULL. - * - * Finishes an operation started with leadvertisement1_call_release(). - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -leadvertisement1_call_release_finish ( - LEAdvertisement1 *proxy, - GAsyncResult *res, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * leadvertisement1_call_release_sync: - * @proxy: A #LEAdvertisement1Proxy. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL. - * - * Synchronously invokes the <link linkend="gdbus-method-org-bluez-LEAdvertisement1.Release">Release()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. - * - * See leadvertisement1_call_release() for the asynchronous version of this method. - * - * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. - */ -gboolean -leadvertisement1_call_release_sync ( - LEAdvertisement1 *proxy, - GCancellable *cancellable, - GError **error) -{ - GVariant *_ret; - _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "Release", - g_variant_new ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - cancellable, - error); - if (_ret == NULL) - goto _out; - g_variant_get (_ret, - "()"); - g_variant_unref (_ret); -_out: - return _ret != NULL; -} - -/** - * leadvertisement1_complete_release: - * @object: A #LEAdvertisement1. - * @invocation: (transfer full): A #GDBusMethodInvocation. - * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-LEAdvertisement1.Release">Release()</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. - * - * This method will free @invocation, you cannot use it afterwards. - */ -void -leadvertisement1_complete_release ( - LEAdvertisement1 *object, - GDBusMethodInvocation *invocation) -{ - g_dbus_method_invocation_return_value (invocation, - g_variant_new ("()")); -} - -/* ------------------------------------------------------------------------ */ - -/** - * LEAdvertisement1Proxy: - * - * The #LEAdvertisement1Proxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * LEAdvertisement1ProxyClass: - * @parent_class: The parent class. - * - * Class structure for #LEAdvertisement1Proxy. - */ - -struct _LEAdvertisement1ProxyPrivate -{ - GData *qdata; -}; - -static void leadvertisement1_proxy_iface_init (LEAdvertisement1Iface *iface); - -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (LEAdvertisement1Proxy, leadvertisement1_proxy, G_TYPE_DBUS_PROXY, - G_ADD_PRIVATE (LEAdvertisement1Proxy) - G_IMPLEMENT_INTERFACE (TYPE_LEADVERTISEMENT1, leadvertisement1_proxy_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (LEAdvertisement1Proxy, leadvertisement1_proxy, G_TYPE_DBUS_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_LEADVERTISEMENT1, leadvertisement1_proxy_iface_init)); - -#endif -static void -leadvertisement1_proxy_finalize (GObject *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - g_datalist_clear (&proxy->priv->qdata); - G_OBJECT_CLASS (leadvertisement1_proxy_parent_class)->finalize (object); -} - -static void -leadvertisement1_proxy_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 6); - info = _leadvertisement1_property_info_pointers[prop_id - 1]; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); - if (info->use_gvariant) - { - g_value_set_variant (value, variant); - } - else - { - if (variant != NULL) - g_dbus_gvariant_to_gvalue (variant, value); - } - if (variant != NULL) - g_variant_unref (variant); -} - -static void -leadvertisement1_proxy_set_property_cb (GDBusProxy *proxy, - GAsyncResult *res, - gpointer user_data) -{ - const _ExtendedGDBusPropertyInfo *info = user_data; - GError *error; - GVariant *_ret; - error = NULL; - _ret = g_dbus_proxy_call_finish (proxy, res, &error); - if (!_ret) - { - g_warning ("Error setting property '%s' on interface org.bluez.LEAdvertisement1: %s (%s, %d)", - info->parent_struct.name, - error->message, g_quark_to_string (error->domain), error->code); - g_error_free (error); - } - else - { - g_variant_unref (_ret); - } -} - -static void -leadvertisement1_proxy_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - const _ExtendedGDBusPropertyInfo *info; - GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 6); - info = _leadvertisement1_property_info_pointers[prop_id - 1]; - variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_dbus_proxy_call (G_DBUS_PROXY (object), - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", "org.bluez.LEAdvertisement1", info->parent_struct.name, variant), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, (GAsyncReadyCallback) leadvertisement1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); - g_variant_unref (variant); -} - -static void -leadvertisement1_proxy_g_signal (GDBusProxy *proxy, - const gchar *sender_name G_GNUC_UNUSED, - const gchar *signal_name, - GVariant *parameters) -{ - _ExtendedGDBusSignalInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint n; - guint signal_id; - info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_leadvertisement1_interface_info.parent_struct, signal_name); - if (info == NULL) - return; - num_params = g_variant_n_children (parameters); - paramv = g_new0 (GValue, num_params + 1); - g_value_init (¶mv[0], TYPE_LEADVERTISEMENT1); - g_value_set_object (¶mv[0], proxy); - g_variant_iter_init (&iter, parameters); - n = 1; - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_LEADVERTISEMENT1); - g_signal_emitv (paramv, signal_id, 0, NULL); - for (n = 0; n < num_params + 1; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static void -leadvertisement1_proxy_g_properties_changed (GDBusProxy *_proxy, - GVariant *changed_properties, - const gchar *const *invalidated_properties) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (_proxy); - guint n; - const gchar *key; - GVariantIter *iter; - _ExtendedGDBusPropertyInfo *info; - g_variant_get (changed_properties, "a{sv}", &iter); - while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_leadvertisement1_interface_info.parent_struct, key); - g_datalist_remove_data (&proxy->priv->qdata, key); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } - g_variant_iter_free (iter); - for (n = 0; invalidated_properties[n] != NULL; n++) - { - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_leadvertisement1_interface_info.parent_struct, invalidated_properties[n]); - g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); - if (info != NULL) - g_object_notify (G_OBJECT (proxy), info->hyphen_name); - } -} - -static const gchar * -leadvertisement1_proxy_get_type_ (LEAdvertisement1 *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - GVariant *variant; - const gchar *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Type"); - if (variant != NULL) - { - value = g_variant_get_string (variant, NULL); - g_variant_unref (variant); - } - return value; -} - -static const gchar *const * -leadvertisement1_proxy_get_service_uuids (LEAdvertisement1 *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - value = g_datalist_get_data (&proxy->priv->qdata, "ServiceUUIDs"); - if (value != NULL) - return value; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ServiceUUIDs"); - if (variant != NULL) - { - value = g_variant_get_strv (variant, NULL); - g_datalist_set_data_full (&proxy->priv->qdata, "ServiceUUIDs", (gpointer) value, g_free); - g_variant_unref (variant); - } - return value; -} - -static GVariant * -leadvertisement1_proxy_get_manufacturer_data (LEAdvertisement1 *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - GVariant *variant; - GVariant *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ManufacturerData"); - value = variant; - if (variant != NULL) - g_variant_unref (variant); - return value; -} - -static const gchar *const * -leadvertisement1_proxy_get_solicit_uuids (LEAdvertisement1 *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - GVariant *variant; - const gchar *const *value = NULL; - value = g_datalist_get_data (&proxy->priv->qdata, "SolicitUUIDs"); - if (value != NULL) - return value; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "SolicitUUIDs"); - if (variant != NULL) - { - value = g_variant_get_strv (variant, NULL); - g_datalist_set_data_full (&proxy->priv->qdata, "SolicitUUIDs", (gpointer) value, g_free); - g_variant_unref (variant); - } - return value; -} - -static GVariant * -leadvertisement1_proxy_get_service_data (LEAdvertisement1 *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - GVariant *variant; - GVariant *value = NULL; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "ServiceData"); - value = variant; - if (variant != NULL) - g_variant_unref (variant); - return value; -} - -static gboolean -leadvertisement1_proxy_get_include_tx_power (LEAdvertisement1 *object) -{ - LEAdvertisement1Proxy *proxy = LEADVERTISEMENT1_PROXY (object); - GVariant *variant; - gboolean value = 0; - variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "IncludeTxPower"); - if (variant != NULL) - { - value = g_variant_get_boolean (variant); - g_variant_unref (variant); - } - return value; -} - -static void -leadvertisement1_proxy_init (LEAdvertisement1Proxy *proxy) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - proxy->priv = leadvertisement1_proxy_get_instance_private (proxy); -#else - proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LEADVERTISEMENT1_PROXY, LEAdvertisement1ProxyPrivate); -#endif - - g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), leadvertisement1_interface_info ()); -} - -static void -leadvertisement1_proxy_class_init (LEAdvertisement1ProxyClass *klass) -{ - GObjectClass *gobject_class; - GDBusProxyClass *proxy_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = leadvertisement1_proxy_finalize; - gobject_class->get_property = leadvertisement1_proxy_get_property; - gobject_class->set_property = leadvertisement1_proxy_set_property; - - proxy_class = G_DBUS_PROXY_CLASS (klass); - proxy_class->g_signal = leadvertisement1_proxy_g_signal; - proxy_class->g_properties_changed = leadvertisement1_proxy_g_properties_changed; - - leadvertisement1_override_properties (gobject_class, 1); - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (LEAdvertisement1ProxyPrivate)); -#endif -} - -static void -leadvertisement1_proxy_iface_init (LEAdvertisement1Iface *iface) -{ - iface->get_type_ = leadvertisement1_proxy_get_type_; - iface->get_service_uuids = leadvertisement1_proxy_get_service_uuids; - iface->get_manufacturer_data = leadvertisement1_proxy_get_manufacturer_data; - iface->get_solicit_uuids = leadvertisement1_proxy_get_solicit_uuids; - iface->get_service_data = leadvertisement1_proxy_get_service_data; - iface->get_include_tx_power = leadvertisement1_proxy_get_include_tx_power; -} - -/** - * leadvertisement1_proxy_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link>. See g_dbus_proxy_new() for more details. - * - * 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. - * You can then call leadvertisement1_proxy_new_finish() to get the result of the operation. - * - * See leadvertisement1_proxy_new_sync() for the synchronous, blocking version of this constructor. - */ -void -leadvertisement1_proxy_new ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_LEADVERTISEMENT1_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.LEAdvertisement1", NULL); -} - -/** - * leadvertisement1_proxy_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to leadvertisement1_proxy_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with leadvertisement1_proxy_new(). - * - * Returns: (transfer full) (type LEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. - */ -LEAdvertisement1 * -leadvertisement1_proxy_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return LEADVERTISEMENT1 (ret); - else - return NULL; -} - -/** - * leadvertisement1_proxy_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link>. See g_dbus_proxy_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See leadvertisement1_proxy_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type LEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. - */ -LEAdvertisement1 * -leadvertisement1_proxy_new_sync ( - GDBusConnection *connection, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_LEADVERTISEMENT1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.LEAdvertisement1", NULL); - if (ret != NULL) - return LEADVERTISEMENT1 (ret); - else - return NULL; -} - - -/** - * leadvertisement1_proxy_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like leadvertisement1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call leadvertisement1_proxy_new_for_bus_finish() to get the result of the operation. - * - * See leadvertisement1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -leadvertisement1_proxy_new_for_bus ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_LEADVERTISEMENT1_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.LEAdvertisement1", NULL); -} - -/** - * leadvertisement1_proxy_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to leadvertisement1_proxy_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with leadvertisement1_proxy_new_for_bus(). - * - * Returns: (transfer full) (type LEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. - */ -LEAdvertisement1 * -leadvertisement1_proxy_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return LEADVERTISEMENT1 (ret); - else - return NULL; -} - -/** - * leadvertisement1_proxy_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusProxyFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like leadvertisement1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See leadvertisement1_proxy_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type LEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. - */ -LEAdvertisement1 * -leadvertisement1_proxy_new_for_bus_sync ( - GBusType bus_type, - GDBusProxyFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_LEADVERTISEMENT1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.LEAdvertisement1", NULL); - if (ret != NULL) - return LEADVERTISEMENT1 (ret); - else - return NULL; -} - - -/* ------------------------------------------------------------------------ */ - -/** - * LEAdvertisement1Skeleton: - * - * The #LEAdvertisement1Skeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * LEAdvertisement1SkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #LEAdvertisement1Skeleton. - */ - -struct _LEAdvertisement1SkeletonPrivate -{ - GValue *properties; - GList *changed_properties; - GSource *changed_properties_idle_source; - GMainContext *context; - GMutex lock; -}; - -static void -_leadvertisement1_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) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (user_data); - _ExtendedGDBusMethodInfo *info; - GVariantIter iter; - GVariant *child; - GValue *paramv; - guint num_params; - guint num_extra; - guint n; - guint signal_id; - GValue return_value = G_VALUE_INIT; - info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); - g_assert (info != NULL); - num_params = g_variant_n_children (parameters); - num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); - n = 0; - g_value_init (¶mv[n], TYPE_LEADVERTISEMENT1); - g_value_set_object (¶mv[n++], skeleton); - g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); - g_value_set_object (¶mv[n++], invocation); - if (info->pass_fdlist) - { -#ifdef G_OS_UNIX - g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); - g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); -#else - g_assert_not_reached (); -#endif - } - g_variant_iter_init (&iter, parameters); - while ((child = g_variant_iter_next_value (&iter)) != NULL) - { - _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; - if (arg_info->use_gvariant) - { - g_value_init (¶mv[n], G_TYPE_VARIANT); - g_value_set_variant (¶mv[n], child); - n++; - } - else - g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); - g_variant_unref (child); - } - signal_id = g_signal_lookup (info->signal_name, TYPE_LEADVERTISEMENT1); - g_value_init (&return_value, G_TYPE_BOOLEAN); - g_signal_emitv (paramv, signal_id, 0, &return_value); - if (!g_value_get_boolean (&return_value)) - 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); - g_value_unset (&return_value); - for (n = 0; n < num_params + num_extra; n++) - g_value_unset (¶mv[n]); - g_free (paramv); -} - -static GVariant * -_leadvertisement1_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) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - GVariant *ret; - ret = NULL; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_leadvertisement1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - g_value_init (&value, pspec->value_type); - g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); - ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); - g_value_unset (&value); - } - return ret; -} - -static gboolean -_leadvertisement1_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) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (user_data); - GValue value = G_VALUE_INIT; - GParamSpec *pspec; - _ExtendedGDBusPropertyInfo *info; - gboolean ret; - ret = FALSE; - info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_leadvertisement1_interface_info.parent_struct, property_name); - g_assert (info != NULL); - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); - if (pspec == NULL) - { - g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); - } - else - { - if (info->use_gvariant) - g_value_set_variant (&value, variant); - else - g_dbus_gvariant_to_gvalue (variant, &value); - g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); - g_value_unset (&value); - ret = TRUE; - } - return ret; -} - -static const GDBusInterfaceVTable _leadvertisement1_skeleton_vtable = -{ - _leadvertisement1_skeleton_handle_method_call, - _leadvertisement1_skeleton_handle_get_property, - _leadvertisement1_skeleton_handle_set_property, - {NULL} -}; - -static GDBusInterfaceInfo * -leadvertisement1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return leadvertisement1_interface_info (); -} - -static GDBusInterfaceVTable * -leadvertisement1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) -{ - return (GDBusInterfaceVTable *) &_leadvertisement1_skeleton_vtable; -} - -static GVariant * -leadvertisement1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (_skeleton); - - GVariantBuilder builder; - guint n; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - if (_leadvertisement1_interface_info.parent_struct.properties == NULL) - goto out; - for (n = 0; _leadvertisement1_interface_info.parent_struct.properties[n] != NULL; n++) - { - GDBusPropertyInfo *info = _leadvertisement1_interface_info.parent_struct.properties[n]; - if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) - { - GVariant *value; - value = _leadvertisement1_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.LEAdvertisement1", info->name, NULL, skeleton); - if (value != NULL) - { - g_variant_take_ref (value); - g_variant_builder_add (&builder, "{sv}", info->name, value); - g_variant_unref (value); - } - } - } -out: - return g_variant_builder_end (&builder); -} - -static gboolean _leadvertisement1_emit_changed (gpointer user_data); - -static void -leadvertisement1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (_skeleton); - gboolean emit_changed = FALSE; - - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties_idle_source != NULL) - { - g_source_destroy (skeleton->priv->changed_properties_idle_source); - skeleton->priv->changed_properties_idle_source = NULL; - emit_changed = TRUE; - } - g_mutex_unlock (&skeleton->priv->lock); - - if (emit_changed) - _leadvertisement1_emit_changed (skeleton); -} - -static void leadvertisement1_skeleton_iface_init (LEAdvertisement1Iface *iface); -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 -G_DEFINE_TYPE_WITH_CODE (LEAdvertisement1Skeleton, leadvertisement1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_ADD_PRIVATE (LEAdvertisement1Skeleton) - G_IMPLEMENT_INTERFACE (TYPE_LEADVERTISEMENT1, leadvertisement1_skeleton_iface_init)); - -#else -G_DEFINE_TYPE_WITH_CODE (LEAdvertisement1Skeleton, leadvertisement1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_LEADVERTISEMENT1, leadvertisement1_skeleton_iface_init)); - -#endif -static void -leadvertisement1_skeleton_finalize (GObject *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - guint n; - for (n = 0; n < 6; n++) - g_value_unset (&skeleton->priv->properties[n]); - g_free (skeleton->priv->properties); - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - if (skeleton->priv->changed_properties_idle_source != NULL) - g_source_destroy (skeleton->priv->changed_properties_idle_source); - g_main_context_unref (skeleton->priv->context); - g_mutex_clear (&skeleton->priv->lock); - G_OBJECT_CLASS (leadvertisement1_skeleton_parent_class)->finalize (object); -} - -static void -leadvertisement1_skeleton_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec G_GNUC_UNUSED) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 6); - g_mutex_lock (&skeleton->priv->lock); - g_value_copy (&skeleton->priv->properties[prop_id - 1], value); - g_mutex_unlock (&skeleton->priv->lock); -} - -static gboolean -_leadvertisement1_emit_changed (gpointer user_data) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (user_data); - GList *l; - GVariantBuilder builder; - GVariantBuilder invalidated_builder; - guint num_changes; - - g_mutex_lock (&skeleton->priv->lock); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); - for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) - { - ChangedProperty *cp = l->data; - GVariant *variant; - const GValue *cur_value; - - cur_value = &skeleton->priv->properties[cp->prop_id - 1]; - if (!_g_value_equal (cur_value, &cp->orig_value)) - { - variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); - g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); - g_variant_unref (variant); - num_changes++; - } - } - if (num_changes > 0) - { - GList *connections, *ll; - GVariant *signal_variant; - signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.LEAdvertisement1", - &builder, &invalidated_builder)); - connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); - for (ll = connections; ll != NULL; ll = ll->next) - { - GDBusConnection *connection = ll->data; - - g_dbus_connection_emit_signal (connection, - NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), - "org.freedesktop.DBus.Properties", - "PropertiesChanged", - signal_variant, - NULL); - } - g_variant_unref (signal_variant); - g_list_free_full (connections, g_object_unref); - } - else - { - g_variant_builder_clear (&builder); - g_variant_builder_clear (&invalidated_builder); - } - g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); - skeleton->priv->changed_properties = NULL; - skeleton->priv->changed_properties_idle_source = NULL; - g_mutex_unlock (&skeleton->priv->lock); - return FALSE; -} - -static void -_leadvertisement1_schedule_emit_changed (LEAdvertisement1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) -{ - ChangedProperty *cp; - GList *l; - cp = NULL; - for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) - { - ChangedProperty *i_cp = l->data; - if (i_cp->info == info) - { - cp = i_cp; - break; - } - } - if (cp == NULL) - { - cp = g_new0 (ChangedProperty, 1); - cp->prop_id = prop_id; - cp->info = info; - skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); - g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); - g_value_copy (orig_value, &cp->orig_value); - } -} - -static void -leadvertisement1_skeleton_notify (GObject *object, - GParamSpec *pspec G_GNUC_UNUSED) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - g_mutex_lock (&skeleton->priv->lock); - if (skeleton->priv->changed_properties != NULL && - skeleton->priv->changed_properties_idle_source == NULL) - { - skeleton->priv->changed_properties_idle_source = g_idle_source_new (); - g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); - g_source_set_callback (skeleton->priv->changed_properties_idle_source, _leadvertisement1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); - g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _leadvertisement1_emit_changed"); - g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); - g_source_unref (skeleton->priv->changed_properties_idle_source); - } - g_mutex_unlock (&skeleton->priv->lock); -} - -static void -leadvertisement1_skeleton_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 6); - g_mutex_lock (&skeleton->priv->lock); - g_object_freeze_notify (object); - if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) - { - if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) - _leadvertisement1_schedule_emit_changed (skeleton, _leadvertisement1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); - g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); - g_object_notify_by_pspec (object, pspec); - } - g_mutex_unlock (&skeleton->priv->lock); - g_object_thaw_notify (object); -} - -static void -leadvertisement1_skeleton_init (LEAdvertisement1Skeleton *skeleton) -{ -#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 - skeleton->priv = leadvertisement1_skeleton_get_instance_private (skeleton); -#else - skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LEADVERTISEMENT1_SKELETON, LEAdvertisement1SkeletonPrivate); -#endif - - g_mutex_init (&skeleton->priv->lock); - skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 6); - g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); - g_value_init (&skeleton->priv->properties[1], G_TYPE_STRV); - g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); - g_value_init (&skeleton->priv->properties[3], G_TYPE_STRV); - g_value_init (&skeleton->priv->properties[4], G_TYPE_VARIANT); - g_value_init (&skeleton->priv->properties[5], G_TYPE_BOOLEAN); -} - -static const gchar * -leadvertisement1_skeleton_get_type_ (LEAdvertisement1 *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - const gchar *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_string (&(skeleton->priv->properties[0])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -leadvertisement1_skeleton_get_service_uuids (LEAdvertisement1 *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[1])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static GVariant * -leadvertisement1_skeleton_get_manufacturer_data (LEAdvertisement1 *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - GVariant *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_variant (&(skeleton->priv->properties[2])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static const gchar *const * -leadvertisement1_skeleton_get_solicit_uuids (LEAdvertisement1 *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - const gchar *const *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boxed (&(skeleton->priv->properties[3])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static GVariant * -leadvertisement1_skeleton_get_service_data (LEAdvertisement1 *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - GVariant *value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_variant (&(skeleton->priv->properties[4])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static gboolean -leadvertisement1_skeleton_get_include_tx_power (LEAdvertisement1 *object) -{ - LEAdvertisement1Skeleton *skeleton = LEADVERTISEMENT1_SKELETON (object); - gboolean value; - g_mutex_lock (&skeleton->priv->lock); - value = g_value_get_boolean (&(skeleton->priv->properties[5])); - g_mutex_unlock (&skeleton->priv->lock); - return value; -} - -static void -leadvertisement1_skeleton_class_init (LEAdvertisement1SkeletonClass *klass) -{ - GObjectClass *gobject_class; - GDBusInterfaceSkeletonClass *skeleton_class; - - gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = leadvertisement1_skeleton_finalize; - gobject_class->get_property = leadvertisement1_skeleton_get_property; - gobject_class->set_property = leadvertisement1_skeleton_set_property; - gobject_class->notify = leadvertisement1_skeleton_notify; - - - leadvertisement1_override_properties (gobject_class, 1); - - skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); - skeleton_class->get_info = leadvertisement1_skeleton_dbus_interface_get_info; - skeleton_class->get_properties = leadvertisement1_skeleton_dbus_interface_get_properties; - skeleton_class->flush = leadvertisement1_skeleton_dbus_interface_flush; - skeleton_class->get_vtable = leadvertisement1_skeleton_dbus_interface_get_vtable; - -#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 - g_type_class_add_private (klass, sizeof (LEAdvertisement1SkeletonPrivate)); -#endif -} - -static void -leadvertisement1_skeleton_iface_init (LEAdvertisement1Iface *iface) -{ - iface->get_type_ = leadvertisement1_skeleton_get_type_; - iface->get_service_uuids = leadvertisement1_skeleton_get_service_uuids; - iface->get_manufacturer_data = leadvertisement1_skeleton_get_manufacturer_data; - iface->get_solicit_uuids = leadvertisement1_skeleton_get_solicit_uuids; - iface->get_service_data = leadvertisement1_skeleton_get_service_data; - iface->get_include_tx_power = leadvertisement1_skeleton_get_include_tx_power; -} - -/** - * leadvertisement1_skeleton_new: - * - * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link>. - * - * Returns: (transfer full) (type LEAdvertisement1Skeleton): The skeleton object. - */ -LEAdvertisement1 * -leadvertisement1_skeleton_new (void) -{ - return LEADVERTISEMENT1 (g_object_new (TYPE_LEADVERTISEMENT1_SKELETON, NULL)); -} - -/* ------------------------------------------------------------------------ - * Code for Object, ObjectProxy and ObjectSkeleton - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:Object - * @title: Object - * @short_description: Specialized GDBusObject types - * - * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. - */ - -/** - * Object: - * - * The #Object type is a specialized container of interfaces. - */ - -/** - * ObjectIface: - * @parent_iface: The parent interface. - * - * Virtual table for the #Object interface. - */ - -typedef ObjectIface ObjectInterface; -G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); - -static void -object_default_init (ObjectIface *iface) -{ - /** - * Object:adapter1: - * - * The #Adapter1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>, if any. - * - * Connect to the #GObject::notify signal to get informed of property changes. - */ - g_object_interface_install_property (iface, g_param_spec_object ("adapter1", "adapter1", "adapter1", TYPE_ADAPTER1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); - - /** - * Object:device1: - * - * The #Device1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>, if any. - * - * Connect to the #GObject::notify signal to get informed of property changes. - */ - g_object_interface_install_property (iface, g_param_spec_object ("device1", "device1", "device1", TYPE_DEVICE1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); - - /** - * Object:gatt-service1: - * - * The #GattService1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>, if any. - * - * Connect to the #GObject::notify signal to get informed of property changes. - */ - g_object_interface_install_property (iface, g_param_spec_object ("gatt-service1", "gatt-service1", "gatt-service1", TYPE_GATT_SERVICE1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); - - /** - * Object:gatt-characteristic1: - * - * The #GattCharacteristic1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>, if any. - * - * Connect to the #GObject::notify signal to get informed of property changes. - */ - g_object_interface_install_property (iface, g_param_spec_object ("gatt-characteristic1", "gatt-characteristic1", "gatt-characteristic1", TYPE_GATT_CHARACTERISTIC1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); - - /** - * Object:gatt-descriptor1: - * - * The #GattDescriptor1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>, if any. - * - * Connect to the #GObject::notify signal to get informed of property changes. - */ - g_object_interface_install_property (iface, g_param_spec_object ("gatt-descriptor1", "gatt-descriptor1", "gatt-descriptor1", TYPE_GATT_DESCRIPTOR1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); - - /** - * Object:leadvertisement1: - * - * The #LEAdvertisement1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link>, if any. - * - * Connect to the #GObject::notify signal to get informed of property changes. - */ - g_object_interface_install_property (iface, g_param_spec_object ("leadvertisement1", "leadvertisement1", "leadvertisement1", TYPE_LEADVERTISEMENT1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); - -} - -/** - * object_get_adapter1: - * @object: A #Object. - * - * Gets the #Adapter1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> on @object, if any. - * - * Returns: (transfer full): A #Adapter1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. - */ -Adapter1 *object_get_adapter1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); - if (ret == NULL) - return NULL; - return ADAPTER1 (ret); -} - -/** - * object_get_device1: - * @object: A #Object. - * - * Gets the #Device1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> on @object, if any. - * - * Returns: (transfer full): A #Device1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. - */ -Device1 *object_get_device1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); - if (ret == NULL) - return NULL; - return DEVICE1 (ret); -} - -/** - * object_get_gatt_service1: - * @object: A #Object. - * - * Gets the #GattService1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> on @object, if any. - * - * Returns: (transfer full): A #GattService1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. - */ -GattService1 *object_get_gatt_service1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); - if (ret == NULL) - return NULL; - return GATT_SERVICE1 (ret); -} - -/** - * object_get_gatt_characteristic1: - * @object: A #Object. - * - * Gets the #GattCharacteristic1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> on @object, if any. - * - * Returns: (transfer full): A #GattCharacteristic1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. - */ -GattCharacteristic1 *object_get_gatt_characteristic1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); - if (ret == NULL) - return NULL; - return GATT_CHARACTERISTIC1 (ret); -} - -/** - * object_get_gatt_descriptor1: - * @object: A #Object. - * - * Gets the #GattDescriptor1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> on @object, if any. - * - * Returns: (transfer full): A #GattDescriptor1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. - */ -GattDescriptor1 *object_get_gatt_descriptor1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); - if (ret == NULL) - return NULL; - return GATT_DESCRIPTOR1 (ret); -} - -/** - * object_get_leadvertisement1: - * @object: A #Object. - * - * Gets the #LEAdvertisement1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link> on @object, if any. - * - * Returns: (transfer full): A #LEAdvertisement1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. - */ -LEAdvertisement1 *object_get_leadvertisement1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.LEAdvertisement1"); - if (ret == NULL) - return NULL; - return LEADVERTISEMENT1 (ret); -} - - -/** - * object_peek_adapter1: (skip) - * @object: A #Object. - * - * Like object_get_adapter1() but doesn't increase the reference count on the returned object. - * - * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> - * - * Returns: (transfer none): A #Adapter1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. - */ -Adapter1 *object_peek_adapter1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); - if (ret == NULL) - return NULL; - g_object_unref (ret); - return ADAPTER1 (ret); -} - -/** - * object_peek_device1: (skip) - * @object: A #Object. - * - * Like object_get_device1() but doesn't increase the reference count on the returned object. - * - * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> - * - * Returns: (transfer none): A #Device1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. - */ -Device1 *object_peek_device1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); - if (ret == NULL) - return NULL; - g_object_unref (ret); - return DEVICE1 (ret); -} - -/** - * object_peek_gatt_service1: (skip) - * @object: A #Object. - * - * Like object_get_gatt_service1() but doesn't increase the reference count on the returned object. - * - * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> - * - * Returns: (transfer none): A #GattService1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. - */ -GattService1 *object_peek_gatt_service1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); - if (ret == NULL) - return NULL; - g_object_unref (ret); - return GATT_SERVICE1 (ret); -} - -/** - * object_peek_gatt_characteristic1: (skip) - * @object: A #Object. - * - * Like object_get_gatt_characteristic1() but doesn't increase the reference count on the returned object. - * - * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> - * - * Returns: (transfer none): A #GattCharacteristic1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. - */ -GattCharacteristic1 *object_peek_gatt_characteristic1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); - if (ret == NULL) - return NULL; - g_object_unref (ret); - return GATT_CHARACTERISTIC1 (ret); -} - -/** - * object_peek_gatt_descriptor1: (skip) - * @object: A #Object. - * - * Like object_get_gatt_descriptor1() but doesn't increase the reference count on the returned object. - * - * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> - * - * Returns: (transfer none): A #GattDescriptor1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. - */ -GattDescriptor1 *object_peek_gatt_descriptor1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); - if (ret == NULL) - return NULL; - g_object_unref (ret); - return GATT_DESCRIPTOR1 (ret); -} - -/** - * object_peek_leadvertisement1: (skip) - * @object: A #Object. - * - * Like object_get_leadvertisement1() but doesn't increase the reference count on the returned object. - * - * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> - * - * Returns: (transfer none): A #LEAdvertisement1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. - */ -LEAdvertisement1 *object_peek_leadvertisement1 (Object *object) -{ - GDBusInterface *ret; - ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.LEAdvertisement1"); - if (ret == NULL) - return NULL; - g_object_unref (ret); - return LEADVERTISEMENT1 (ret); -} - - -static void -object_notify (GDBusObject *object, GDBusInterface *interface) -{ - _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); - /* info can be NULL if the other end is using a D-Bus interface we don't know - * anything about, for example old generated code in this process talking to - * newer generated code in the other process. */ - if (info != NULL) - g_object_notify (G_OBJECT (object), info->hyphen_name); -} - -/** - * ObjectProxy: - * - * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. - */ - -/** - * ObjectProxyClass: - * @parent_class: The parent class. - * - * Class structure for #ObjectProxy. - */ - -static void -object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) -{ -} - -static void -object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) -{ - iface->interface_added = object_notify; - iface->interface_removed = object_notify; -} - - -G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, - G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) - G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); - -static void -object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) -{ -} - -static void -object_proxy_set_property (GObject *gobject, - guint prop_id, - const GValue *value G_GNUC_UNUSED, - GParamSpec *pspec) -{ - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); -} - -static void -object_proxy_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - ObjectProxy *object = OBJECT_PROXY (gobject); - GDBusInterface *interface; - - switch (prop_id) - { - case 1: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); - g_value_take_object (value, interface); - break; - - case 2: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); - g_value_take_object (value, interface); - break; - - case 3: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); - g_value_take_object (value, interface); - break; - - case 4: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); - g_value_take_object (value, interface); - break; - - case 5: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); - g_value_take_object (value, interface); - break; - - case 6: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.LEAdvertisement1"); - g_value_take_object (value, interface); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -object_proxy_class_init (ObjectProxyClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->set_property = object_proxy_set_property; - gobject_class->get_property = object_proxy_get_property; - - g_object_class_override_property (gobject_class, 1, "adapter1"); - g_object_class_override_property (gobject_class, 2, "device1"); - g_object_class_override_property (gobject_class, 3, "gatt-service1"); - g_object_class_override_property (gobject_class, 4, "gatt-characteristic1"); - g_object_class_override_property (gobject_class, 5, "gatt-descriptor1"); - g_object_class_override_property (gobject_class, 6, "leadvertisement1"); -} - -/** - * object_proxy_new: - * @connection: A #GDBusConnection. - * @object_path: An object path. - * - * Creates a new proxy object. - * - * Returns: (transfer full): The proxy object. - */ -ObjectProxy * -object_proxy_new (GDBusConnection *connection, - const gchar *object_path) -{ - g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); - g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); - return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); -} - -/** - * ObjectSkeleton: - * - * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. - */ - -/** - * ObjectSkeletonClass: - * @parent_class: The parent class. - * - * Class structure for #ObjectSkeleton. - */ - -static void -object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) -{ -} - - -static void -object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) -{ - iface->interface_added = object_notify; - iface->interface_removed = object_notify; -} - -G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, - G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) - G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); - -static void -object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) -{ -} - -static void -object_skeleton_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - ObjectSkeleton *object = OBJECT_SKELETON (gobject); - GDBusInterfaceSkeleton *interface; - - switch (prop_id) - { - case 1: - interface = g_value_get_object (value); - if (interface != NULL) - { - g_warn_if_fail (IS_ADAPTER1 (interface)); - g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); - } - else - { - g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.Adapter1"); - } - break; - - case 2: - interface = g_value_get_object (value); - if (interface != NULL) - { - g_warn_if_fail (IS_DEVICE1 (interface)); - g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); - } - else - { - g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.Device1"); - } - break; - - case 3: - interface = g_value_get_object (value); - if (interface != NULL) - { - g_warn_if_fail (IS_GATT_SERVICE1 (interface)); - g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); - } - else - { - g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.GattService1"); - } - break; - - case 4: - interface = g_value_get_object (value); - if (interface != NULL) - { - g_warn_if_fail (IS_GATT_CHARACTERISTIC1 (interface)); - g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); - } - else - { - g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.GattCharacteristic1"); - } - break; - - case 5: - interface = g_value_get_object (value); - if (interface != NULL) - { - g_warn_if_fail (IS_GATT_DESCRIPTOR1 (interface)); - g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); - } - else - { - g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.GattDescriptor1"); - } - break; - - case 6: - interface = g_value_get_object (value); - if (interface != NULL) - { - g_warn_if_fail (IS_LEADVERTISEMENT1 (interface)); - g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); - } - else - { - g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.LEAdvertisement1"); - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -object_skeleton_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - ObjectSkeleton *object = OBJECT_SKELETON (gobject); - GDBusInterface *interface; - - switch (prop_id) - { - case 1: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); - g_value_take_object (value, interface); - break; - - case 2: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); - g_value_take_object (value, interface); - break; - - case 3: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); - g_value_take_object (value, interface); - break; - - case 4: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); - g_value_take_object (value, interface); - break; - - case 5: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); - g_value_take_object (value, interface); - break; - - case 6: - interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.LEAdvertisement1"); - g_value_take_object (value, interface); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -object_skeleton_class_init (ObjectSkeletonClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->set_property = object_skeleton_set_property; - gobject_class->get_property = object_skeleton_get_property; - - g_object_class_override_property (gobject_class, 1, "adapter1"); - g_object_class_override_property (gobject_class, 2, "device1"); - g_object_class_override_property (gobject_class, 3, "gatt-service1"); - g_object_class_override_property (gobject_class, 4, "gatt-characteristic1"); - g_object_class_override_property (gobject_class, 5, "gatt-descriptor1"); - g_object_class_override_property (gobject_class, 6, "leadvertisement1"); -} - -/** - * object_skeleton_new: - * @object_path: An object path. - * - * Creates a new skeleton object. - * - * Returns: (transfer full): The skeleton object. - */ -ObjectSkeleton * -object_skeleton_new (const gchar *object_path) -{ - g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); - return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); -} - -/** - * object_skeleton_set_adapter1: - * @object: A #ObjectSkeleton. - * @interface_: (allow-none): A #Adapter1 or %NULL to clear the interface. - * - * Sets the #Adapter1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> on @object. - */ -void object_skeleton_set_adapter1 (ObjectSkeleton *object, Adapter1 *interface_) -{ - g_object_set (G_OBJECT (object), "adapter1", interface_, NULL); -} - -/** - * object_skeleton_set_device1: - * @object: A #ObjectSkeleton. - * @interface_: (allow-none): A #Device1 or %NULL to clear the interface. - * - * Sets the #Device1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> on @object. - */ -void object_skeleton_set_device1 (ObjectSkeleton *object, Device1 *interface_) -{ - g_object_set (G_OBJECT (object), "device1", interface_, NULL); -} - -/** - * object_skeleton_set_gatt_service1: - * @object: A #ObjectSkeleton. - * @interface_: (allow-none): A #GattService1 or %NULL to clear the interface. - * - * Sets the #GattService1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> on @object. - */ -void object_skeleton_set_gatt_service1 (ObjectSkeleton *object, GattService1 *interface_) -{ - g_object_set (G_OBJECT (object), "gatt-service1", interface_, NULL); -} - -/** - * object_skeleton_set_gatt_characteristic1: - * @object: A #ObjectSkeleton. - * @interface_: (allow-none): A #GattCharacteristic1 or %NULL to clear the interface. - * - * Sets the #GattCharacteristic1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> on @object. - */ -void object_skeleton_set_gatt_characteristic1 (ObjectSkeleton *object, GattCharacteristic1 *interface_) -{ - g_object_set (G_OBJECT (object), "gatt-characteristic1", interface_, NULL); -} - -/** - * object_skeleton_set_gatt_descriptor1: - * @object: A #ObjectSkeleton. - * @interface_: (allow-none): A #GattDescriptor1 or %NULL to clear the interface. - * - * Sets the #GattDescriptor1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> on @object. - */ -void object_skeleton_set_gatt_descriptor1 (ObjectSkeleton *object, GattDescriptor1 *interface_) -{ - g_object_set (G_OBJECT (object), "gatt-descriptor1", interface_, NULL); -} - -/** - * object_skeleton_set_leadvertisement1: - * @object: A #ObjectSkeleton. - * @interface_: (allow-none): A #LEAdvertisement1 or %NULL to clear the interface. - * - * Sets the #LEAdvertisement1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-LEAdvertisement1.top_of_page">org.bluez.LEAdvertisement1</link> on @object. - */ -void object_skeleton_set_leadvertisement1 (ObjectSkeleton *object, LEAdvertisement1 *interface_) -{ - g_object_set (G_OBJECT (object), "leadvertisement1", interface_, NULL); -} - - -/* ------------------------------------------------------------------------ - * Code for ObjectManager client - * ------------------------------------------------------------------------ - */ - -/** - * SECTION:ObjectManagerClient - * @title: ObjectManagerClient - * @short_description: Generated GDBusObjectManagerClient type - * - * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. - */ - -/** - * ObjectManagerClient: - * - * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. - */ - -/** - * ObjectManagerClientClass: - * @parent_class: The parent class. - * - * Class structure for #ObjectManagerClient. - */ - -G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); - -static void -object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) -{ -} - -static void -object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) -{ -} - -/** - * object_manager_client_get_proxy_type: - * @manager: A #GDBusObjectManagerClient. - * @object_path: The object path of the remote object (unused). - * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. - * @user_data: User data (unused). - * - * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. - * - * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. - */ -GType -object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED) -{ - static gsize once_init_value = 0; - static GHashTable *lookup_hash; - GType ret; - - if (interface_name == NULL) - return TYPE_OBJECT_PROXY; - if (g_once_init_enter (&once_init_value)) - { - lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.Adapter1", GSIZE_TO_POINTER (TYPE_ADAPTER1_PROXY)); - g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.Device1", GSIZE_TO_POINTER (TYPE_DEVICE1_PROXY)); - g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.GattService1", GSIZE_TO_POINTER (TYPE_GATT_SERVICE1_PROXY)); - g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.GattCharacteristic1", GSIZE_TO_POINTER (TYPE_GATT_CHARACTERISTIC1_PROXY)); - g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.GattDescriptor1", GSIZE_TO_POINTER (TYPE_GATT_DESCRIPTOR1_PROXY)); - g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.LEAdvertisement1", GSIZE_TO_POINTER (TYPE_LEADVERTISEMENT1_PROXY)); - g_once_init_leave (&once_init_value, 1); - } - ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); - if (ret == (GType) 0) - ret = G_TYPE_DBUS_PROXY; - return ret; -} - -/** - * object_manager_client_new: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. - * - * 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. - * You can then call object_manager_client_new_finish() to get the result of the operation. - * - * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. - */ -void -object_manager_client_new ( - GDBusConnection *connection, - GDBusObjectManagerClientFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); -} - -/** - * object_manager_client_new_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with object_manager_client_new(). - * - * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. - */ -GDBusObjectManager * -object_manager_client_new_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return G_DBUS_OBJECT_MANAGER (ret); - else - return NULL; -} - -/** - * object_manager_client_new_sync: - * @connection: A #GDBusConnection. - * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. - * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. - * - * The calling thread is blocked until a reply is received. - * - * See object_manager_client_new() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. - */ -GDBusObjectManager * -object_manager_client_new_sync ( - GDBusConnection *connection, - GDBusObjectManagerClientFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); - if (ret != NULL) - return G_DBUS_OBJECT_MANAGER (ret); - else - return NULL; -} - - -/** - * object_manager_client_new_for_bus: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @callback: A #GAsyncReadyCallback to call when the request is satisfied. - * @user_data: User data to pass to @callback. - * - * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. - * - * 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. - * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. - * - * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. - */ -void -object_manager_client_new_for_bus ( - GBusType bus_type, - GDBusObjectManagerClientFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); -} - -/** - * object_manager_client_new_for_bus_finish: - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). - * @error: Return location for error or %NULL - * - * Finishes an operation started with object_manager_client_new_for_bus(). - * - * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. - */ -GDBusObjectManager * -object_manager_client_new_for_bus_finish ( - GAsyncResult *res, - GError **error) -{ - GObject *ret; - GObject *source_object; - source_object = g_async_result_get_source_object (res); - ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); - g_object_unref (source_object); - if (ret != NULL) - return G_DBUS_OBJECT_MANAGER (ret); - else - return NULL; -} - -/** - * object_manager_client_new_for_bus_sync: - * @bus_type: A #GBusType. - * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. - * @name: A bus name (well-known or unique). - * @object_path: An object path. - * @cancellable: (allow-none): A #GCancellable or %NULL. - * @error: Return location for error or %NULL - * - * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. - * - * The calling thread is blocked until a reply is received. - * - * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. - * - * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. - */ -GDBusObjectManager * -object_manager_client_new_for_bus_sync ( - GBusType bus_type, - GDBusObjectManagerClientFlags flags, - const gchar *name, - const gchar *object_path, - GCancellable *cancellable, - GError **error) -{ - GInitable *ret; - ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); - if (ret != NULL) - return G_DBUS_OBJECT_MANAGER (ret); - else - return NULL; -} - - |