From 928d8bc0941a74c1918fb72b06db59613a2afd49 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Tue, 18 Sep 2018 08:31:03 +0200 Subject: binding: telephony: add initial binding Split out binding from phone application Bug-AGL: SPEC-1757 Change-Id: Ie66364e20528ec1b7c67deb20247a843b289b68c Signed-off-by: Matt Ranostay --- binding/CMakeLists.txt | 41 + binding/gdbus/api/ofono_manager.xml | 16 + binding/gdbus/api/ofono_voice_call.xml | 25 + binding/gdbus/api/ofono_voicecallmanager.xml | 51 + binding/gdbus/generate_interfaces.sh | 20 + binding/gdbus/ofono_manager.c | 178 ++ binding/gdbus/ofono_manager.h | 33 + binding/gdbus/ofono_manager_interface.c | 1804 ++++++++++++ binding/gdbus/ofono_manager_interface.h | 356 +++ binding/gdbus/ofono_voicecall.c | 91 + binding/gdbus/ofono_voicecall.h | 26 + binding/gdbus/ofono_voicecall_interface.c | 1895 ++++++++++++ binding/gdbus/ofono_voicecall_interface.h | 305 ++ binding/gdbus/ofono_voicecallmanager.c | 160 ++ binding/gdbus/ofono_voicecallmanager.h | 28 + binding/gdbus/ofono_voicecallmanager_interface.c | 3336 ++++++++++++++++++++++ binding/gdbus/ofono_voicecallmanager_interface.h | 514 ++++ binding/telephony-binding.c | 370 +++ 18 files changed, 9249 insertions(+) create mode 100644 binding/CMakeLists.txt create mode 100644 binding/gdbus/api/ofono_manager.xml create mode 100644 binding/gdbus/api/ofono_voice_call.xml create mode 100644 binding/gdbus/api/ofono_voicecallmanager.xml create mode 100755 binding/gdbus/generate_interfaces.sh create mode 100644 binding/gdbus/ofono_manager.c create mode 100644 binding/gdbus/ofono_manager.h create mode 100644 binding/gdbus/ofono_manager_interface.c create mode 100644 binding/gdbus/ofono_manager_interface.h create mode 100644 binding/gdbus/ofono_voicecall.c create mode 100644 binding/gdbus/ofono_voicecall.h create mode 100644 binding/gdbus/ofono_voicecall_interface.c create mode 100644 binding/gdbus/ofono_voicecall_interface.h create mode 100644 binding/gdbus/ofono_voicecallmanager.c create mode 100644 binding/gdbus/ofono_voicecallmanager.h create mode 100644 binding/gdbus/ofono_voicecallmanager_interface.c create mode 100644 binding/gdbus/ofono_voicecallmanager_interface.h create mode 100644 binding/telephony-binding.c (limited to 'binding') diff --git a/binding/CMakeLists.txt b/binding/CMakeLists.txt new file mode 100644 index 0000000..962eeff --- /dev/null +++ b/binding/CMakeLists.txt @@ -0,0 +1,41 @@ +########################################################################### +# Copyright 2015, 2016, 2017 IoT.bzh +# +# author: Fulup Ar Foll +# contrib: Romain Forlot +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + +# Add target to project dependency list +PROJECT_TARGET_ADD(afm-telephony-binding) + + # oFono gdbus headers + include_directories(gdbus) + + # Define project Targets + add_library(afm-telephony-binding MODULE telephony-binding.c + gdbus/ofono_manager.c + gdbus/ofono_voicecallmanager.c + gdbus/ofono_voicecall.c) + + # Binder exposes a unique public entry point + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + PREFIX "lib" + LABELS "BINDING" + LINK_FLAGS ${BINDINGS_LINK_FLAG} + OUTPUT_NAME ${TARGET_NAME} + ) + + # Library dependencies (include updates automatically) + TARGET_LINK_LIBRARIES(${TARGET_NAME} ${link_libraries}) diff --git a/binding/gdbus/api/ofono_manager.xml b/binding/gdbus/api/ofono_manager.xml new file mode 100644 index 0000000..0d8d65b --- /dev/null +++ b/binding/gdbus/api/ofono_manager.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/binding/gdbus/api/ofono_voice_call.xml b/binding/gdbus/api/ofono_voice_call.xml new file mode 100644 index 0000000..6dd7391 --- /dev/null +++ b/binding/gdbus/api/ofono_voice_call.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binding/gdbus/api/ofono_voicecallmanager.xml b/binding/gdbus/api/ofono_voicecallmanager.xml new file mode 100644 index 0000000..2a032f5 --- /dev/null +++ b/binding/gdbus/api/ofono_voicecallmanager.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binding/gdbus/generate_interfaces.sh b/binding/gdbus/generate_interfaces.sh new file mode 100755 index 0000000..a60c435 --- /dev/null +++ b/binding/gdbus/generate_interfaces.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +CG=gdbus-codegen +API=api + +$CG \ + --interface-prefix Ofono.Manager. \ + --generate-c-code ofono_manager_interface \ + --c-generate-object-manager \ + $API/ofono_manager.xml + +$CG \ + --interface-prefix Ofono.VoiceCallManager. \ + --generate-c-code ofono_voicecallmanager_interface \ + $API/ofono_voicecallmanager.xml + +$CG \ + --interface-prefix Ofono.VoiceCall. \ + --generate-c-code ofono_voicecall_interface \ + $API/ofono_voice_call.xml diff --git a/binding/gdbus/ofono_manager.c b/binding/gdbus/ofono_manager.c new file mode 100644 index 0000000..98b0fdc --- /dev/null +++ b/binding/gdbus/ofono_manager.c @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2017-2018 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE + +#include + +#define AFB_BINDING_VERSION 2 +#include + +#include "ofono_manager.h" +#include "ofono_manager_interface.h" + +struct ofono_manager_modem +{ + const gchar *address; + const gchar *path; + const gchar *name; + const gchar *type; + gboolean powered; + gboolean online; + gboolean valid; +}; + +static OrgOfonoManager *manager; +static struct ofono_manager_modem default_modem; + +void ofono_manager_invalidate_default_modem() +{ + default_modem.valid = FALSE; +} + +int ofono_manager_set_default_modem(const char *address) +{ + GVariant *out_arg = NULL, *next, *value; + GError *error = NULL; + gchar *path, *key; + const gchar *name = NULL, *type = NULL, *serial = NULL; + gboolean powered = FALSE, online = FALSE; + GVariantIter *iter, *iter2 = NULL; + int ret = 0; + + /* Fetch all visible modems */ + org_ofono_manager_call_get_modems_sync(manager, &out_arg, NULL, &error); + if (error == NULL) { + g_variant_get(out_arg, "a(oa{sv})", &iter); + /* Iterate over each modem */ + while ((next = g_variant_iter_next_value(iter))) { + g_variant_get(next, "(oa{sv})", &path, &iter2); + while (g_variant_iter_loop(iter2, "{sv}", &key, &value)) { + if (!strcmp(key, "Name")) + name = g_variant_get_string(value, NULL); + else if (!strcmp(key, "Online")) + online = g_variant_get_boolean(value); + else if (!strcmp(key, "Powered")) + powered = g_variant_get_boolean(value); + else if (!strcmp(key, "Serial")) + serial = g_variant_get_string(value, NULL); + else if (!strcmp(key, "Type")) + type = g_variant_get_string(value, NULL); + } + /* If the HFP modem matches the BT address, is powered, and online then set as default */ + if (!strcmp(type, "hfp") && !strcmp(address, serial) && powered && online) { + default_modem.address = serial; + default_modem.path = path; + default_modem.name = name; + default_modem.type = type; + default_modem.powered = powered; + default_modem.online = online; + default_modem.valid = TRUE; + AFB_NOTICE("New modem: %s (%s)", name, address); + break; + } + } + } else { + ret = -1; + } + + return ret; +} + +int ofono_manager_init() +{ + int ret = 0; + + if (manager) { + AFB_ERROR("Ofono Manager already initialized\n"); + return -1; + } + + manager = org_ofono_manager_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, + "org.ofono", "/", NULL, NULL); + + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + return -1; + } + + + return ret; +} + +const gchar *ofono_manager_get_default_modem_address(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.address; +} + +const gchar *ofono_manager_get_default_modem_path(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.path; +} + +const gchar *ofono_manager_get_default_modem_name(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.name; +} + +const gchar *ofono_manager_get_default_modem_type(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.type; +} + +gboolean ofono_manager_get_default_modem_powered(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.powered; +} + +gboolean ofono_manager_get_default_modem_online(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.online; +} + +gboolean ofono_manager_get_default_modem_valid(void) +{ + if (!manager) { + AFB_ERROR("Ofono Manager not initialized\n"); + } + + return default_modem.valid; +} diff --git a/binding/gdbus/ofono_manager.h b/binding/gdbus/ofono_manager.h new file mode 100644 index 0000000..6ab7785 --- /dev/null +++ b/binding/gdbus/ofono_manager.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017-2018 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define _GNU_SOURCE + +#define AFB_BINDING_VERSION 2 +#include + +int ofono_manager_init(void); +void ofono_manager_invalidate_default_modem(void); +int ofono_manager_set_default_modem(const char *); +const gchar *ofono_manager_get_default_modem_address(void); +const gchar *ofono_manager_get_default_modem_path(void); +const gchar *ofono_manager_get_default_modem_name(void); +const gchar *ofono_manager_get_default_modem_type(void); +gboolean ofono_manager_get_default_modem_powered(void); +gboolean ofono_manager_get_default_modem_online(void); +gboolean ofono_manager_get_default_modem_valid(void); diff --git a/binding/gdbus/ofono_manager_interface.c b/binding/gdbus/ofono_manager_interface.c new file mode 100644 index 0000000..d58021f --- /dev/null +++ b/binding/gdbus/ofono_manager_interface.c @@ -0,0 +1,1804 @@ +/* + * Generated by gdbus-codegen 2.50.3. 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 "ofono_manager_interface.h" + +#include +#ifdef G_OS_UNIX +# include +#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.ofono.Manager + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:OrgOfonoManager + * @title: OrgOfonoManager + * @short_description: Generated C code for the org.ofono.Manager D-Bus interface + * + * This section contains code for working with the org.ofono.Manager D-Bus interface in C. + */ + +/* ---- Introspection data for org.ofono.Manager ---- */ + +static const _ExtendedGDBusArgInfo _org_ofono_manager_method_info_get_modems_OUT_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "a(oa{sv})", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_manager_method_info_get_modems_OUT_ARG_pointers[] = +{ + &_org_ofono_manager_method_info_get_modems_OUT_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_manager_method_info_get_modems = +{ + { + -1, + (gchar *) "GetModems", + NULL, + (GDBusArgInfo **) &_org_ofono_manager_method_info_get_modems_OUT_ARG_pointers, + NULL + }, + "handle-get-modems", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _org_ofono_manager_method_info_pointers[] = +{ + &_org_ofono_manager_method_info_get_modems, + NULL +}; + +static const _ExtendedGDBusArgInfo _org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "a{sv}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_manager_signal_info_modem_added_ARG_pointers[] = +{ + &_org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg0, + &_org_ofono_manager_signal_info_modem_added_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_manager_signal_info_modem_added = +{ + { + -1, + (gchar *) "ModemAdded", + (GDBusArgInfo **) &_org_ofono_manager_signal_info_modem_added_ARG_pointers, + NULL + }, + "modem-added" +}; + +static const _ExtendedGDBusArgInfo _org_ofono_manager_signal_info_modem_removed_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_manager_signal_info_modem_removed_ARG_pointers[] = +{ + &_org_ofono_manager_signal_info_modem_removed_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_manager_signal_info_modem_removed = +{ + { + -1, + (gchar *) "ModemRemoved", + (GDBusArgInfo **) &_org_ofono_manager_signal_info_modem_removed_ARG_pointers, + NULL + }, + "modem-removed" +}; + +static const _ExtendedGDBusSignalInfo * const _org_ofono_manager_signal_info_pointers[] = +{ + &_org_ofono_manager_signal_info_modem_added, + &_org_ofono_manager_signal_info_modem_removed, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _org_ofono_manager_interface_info = +{ + { + -1, + (gchar *) "org.ofono.Manager", + (GDBusMethodInfo **) &_org_ofono_manager_method_info_pointers, + (GDBusSignalInfo **) &_org_ofono_manager_signal_info_pointers, + NULL, + NULL + }, + "org-ofono-manager", +}; + + +/** + * org_ofono_manager_interface_info: + * + * Gets a machine-readable description of the org.ofono.Manager D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +org_ofono_manager_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_org_ofono_manager_interface_info.parent_struct; +} + +/** + * org_ofono_manager_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 #OrgOfonoManager interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +org_ofono_manager_override_properties (GObjectClass *klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + + + +/** + * OrgOfonoManager: + * + * Abstract interface type for the D-Bus interface org.ofono.Manager. + */ + +/** + * OrgOfonoManagerIface: + * @parent_iface: The parent interface. + * @handle_get_modems: Handler for the #OrgOfonoManager::handle-get-modems signal. + * @modem_added: Handler for the #OrgOfonoManager::modem-added signal. + * @modem_removed: Handler for the #OrgOfonoManager::modem-removed signal. + * + * Virtual table for the D-Bus interface org.ofono.Manager. + */ + +typedef OrgOfonoManagerIface OrgOfonoManagerInterface; +G_DEFINE_INTERFACE (OrgOfonoManager, org_ofono_manager, G_TYPE_OBJECT); + +static void +org_ofono_manager_default_init (OrgOfonoManagerIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * OrgOfonoManager::handle-get-modems: + * @object: A #OrgOfonoManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the GetModems() 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 org_ofono_manager_complete_get_modems() 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-get-modems", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoManagerIface, handle_get_modems), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject signals for received D-Bus signals: */ + /** + * OrgOfonoManager::modem-added: + * @object: A #OrgOfonoManager. + * @arg_unnamed_arg0: Argument. + * @arg_unnamed_arg1: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "ModemAdded" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("modem-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoManagerIface, modem_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * OrgOfonoManager::modem-removed: + * @object: A #OrgOfonoManager. + * @arg_unnamed_arg0: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "ModemRemoved" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("modem-removed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoManagerIface, modem_removed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + +} + +/** + * org_ofono_manager_emit_modem_added: + * @object: A #OrgOfonoManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * @arg_unnamed_arg1: Argument to pass with the signal. + * + * Emits the "ModemAdded" D-Bus signal. + */ +void +org_ofono_manager_emit_modem_added ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + g_signal_emit_by_name (object, "modem-added", arg_unnamed_arg0, arg_unnamed_arg1); +} + +/** + * org_ofono_manager_emit_modem_removed: + * @object: A #OrgOfonoManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * + * Emits the "ModemRemoved" D-Bus signal. + */ +void +org_ofono_manager_emit_modem_removed ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0) +{ + g_signal_emit_by_name (object, "modem-removed", arg_unnamed_arg0); +} + +/** + * org_ofono_manager_call_get_modems: + * @proxy: A #OrgOfonoManagerProxy. + * @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 GetModems() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_manager_call_get_modems_finish() to get the result of the operation. + * + * See org_ofono_manager_call_get_modems_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_manager_call_get_modems ( + OrgOfonoManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetModems", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_manager_call_get_modems_finish: + * @proxy: A #OrgOfonoManagerProxy. + * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_manager_call_get_modems(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_manager_call_get_modems(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_manager_call_get_modems_finish ( + OrgOfonoManager *proxy, + GVariant **out_unnamed_arg0, + 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, + "(@a(oa{sv}))", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_manager_call_get_modems_sync: + * @proxy: A #OrgOfonoManagerProxy. + * @out_unnamed_arg0: (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 GetModems() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_manager_call_get_modems() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_manager_call_get_modems_sync ( + OrgOfonoManager *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetModems", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a(oa{sv}))", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_manager_complete_get_modems: + * @object: A #OrgOfonoManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg0: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetModems() 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 +org_ofono_manager_complete_get_modems ( + OrgOfonoManager *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@a(oa{sv}))", + unnamed_arg0)); +} + +/* ------------------------------------------------------------------------ */ + +/** + * OrgOfonoManagerProxy: + * + * The #OrgOfonoManagerProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * OrgOfonoManagerProxyClass: + * @parent_class: The parent class. + * + * Class structure for #OrgOfonoManagerProxy. + */ + +struct _OrgOfonoManagerProxyPrivate +{ + GData *qdata; +}; + +static void org_ofono_manager_proxy_iface_init (OrgOfonoManagerIface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerProxy, org_ofono_manager_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (OrgOfonoManagerProxy) + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerProxy, org_ofono_manager_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_proxy_iface_init)); + +#endif +static void +org_ofono_manager_proxy_finalize (GObject *object) +{ + OrgOfonoManagerProxy *proxy = ORG_OFONO_MANAGER_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (org_ofono_manager_proxy_parent_class)->finalize (object); +} + +static void +org_ofono_manager_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ +} + +static void +org_ofono_manager_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ +} + +static void +org_ofono_manager_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 *) &_org_ofono_manager_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_ORG_OFONO_MANAGER); + 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_ORG_OFONO_MANAGER); + 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 +org_ofono_manager_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + OrgOfonoManagerProxy *proxy = ORG_OFONO_MANAGER_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 *) &_org_ofono_manager_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 *) &_org_ofono_manager_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 void +org_ofono_manager_proxy_init (OrgOfonoManagerProxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = org_ofono_manager_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ORG_OFONO_MANAGER_PROXY, OrgOfonoManagerProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), org_ofono_manager_interface_info ()); +} + +static void +org_ofono_manager_proxy_class_init (OrgOfonoManagerProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = org_ofono_manager_proxy_finalize; + gobject_class->get_property = org_ofono_manager_proxy_get_property; + gobject_class->set_property = org_ofono_manager_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = org_ofono_manager_proxy_g_signal; + proxy_class->g_properties_changed = org_ofono_manager_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (OrgOfonoManagerProxyPrivate)); +#endif +} + +static void +org_ofono_manager_proxy_iface_init (OrgOfonoManagerIface *iface) +{ +} + +/** + * org_ofono_manager_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 org.ofono.Manager. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_manager_proxy_new_finish() to get the result of the operation. + * + * See org_ofono_manager_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +org_ofono_manager_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_ORG_OFONO_MANAGER_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.ofono.Manager", NULL); +} + +/** + * org_ofono_manager_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_manager_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with org_ofono_manager_proxy_new(). + * + * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoManager * +org_ofono_manager_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 ORG_OFONO_MANAGER (ret); + else + return NULL; +} + +/** + * org_ofono_manager_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 org.ofono.Manager. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See org_ofono_manager_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoManager * +org_ofono_manager_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_ORG_OFONO_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.ofono.Manager", NULL); + if (ret != NULL) + return ORG_OFONO_MANAGER (ret); + else + return NULL; +} + + +/** + * org_ofono_manager_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 org_ofono_manager_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_manager_proxy_new_for_bus_finish() to get the result of the operation. + * + * See org_ofono_manager_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +org_ofono_manager_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_ORG_OFONO_MANAGER_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.ofono.Manager", NULL); +} + +/** + * org_ofono_manager_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_manager_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with org_ofono_manager_proxy_new_for_bus(). + * + * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoManager * +org_ofono_manager_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 ORG_OFONO_MANAGER (ret); + else + return NULL; +} + +/** + * org_ofono_manager_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 org_ofono_manager_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See org_ofono_manager_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type OrgOfonoManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoManager * +org_ofono_manager_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_ORG_OFONO_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.ofono.Manager", NULL); + if (ret != NULL) + return ORG_OFONO_MANAGER (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * OrgOfonoManagerSkeleton: + * + * The #OrgOfonoManagerSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * OrgOfonoManagerSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #OrgOfonoManagerSkeleton. + */ + +struct _OrgOfonoManagerSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_org_ofono_manager_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) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_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_ORG_OFONO_MANAGER); + 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_ORG_OFONO_MANAGER); + 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 * +_org_ofono_manager_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) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_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 *) &_org_ofono_manager_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 +_org_ofono_manager_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) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_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 *) &_org_ofono_manager_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 _org_ofono_manager_skeleton_vtable = +{ + _org_ofono_manager_skeleton_handle_method_call, + _org_ofono_manager_skeleton_handle_get_property, + _org_ofono_manager_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +org_ofono_manager_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return org_ofono_manager_interface_info (); +} + +static GDBusInterfaceVTable * +org_ofono_manager_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_org_ofono_manager_skeleton_vtable; +} + +static GVariant * +org_ofono_manager_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_org_ofono_manager_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _org_ofono_manager_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _org_ofono_manager_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _org_ofono_manager_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.ofono.Manager", 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 void +org_ofono_manager_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ +} + +static void +_org_ofono_manager_on_signal_modem_added ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o@a{sv})", + arg_unnamed_arg0, + arg_unnamed_arg1)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.Manager", "ModemAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_org_ofono_manager_on_signal_modem_removed ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_unnamed_arg0)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.Manager", "ModemRemoved", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void org_ofono_manager_skeleton_iface_init (OrgOfonoManagerIface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerSkeleton, org_ofono_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (OrgOfonoManagerSkeleton) + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (OrgOfonoManagerSkeleton, org_ofono_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_MANAGER, org_ofono_manager_skeleton_iface_init)); + +#endif +static void +org_ofono_manager_skeleton_finalize (GObject *object) +{ + OrgOfonoManagerSkeleton *skeleton = ORG_OFONO_MANAGER_SKELETON (object); + 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 (org_ofono_manager_skeleton_parent_class)->finalize (object); +} + +static void +org_ofono_manager_skeleton_init (OrgOfonoManagerSkeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = org_ofono_manager_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ORG_OFONO_MANAGER_SKELETON, OrgOfonoManagerSkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); +} + +static void +org_ofono_manager_skeleton_class_init (OrgOfonoManagerSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = org_ofono_manager_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = org_ofono_manager_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = org_ofono_manager_skeleton_dbus_interface_get_properties; + skeleton_class->flush = org_ofono_manager_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = org_ofono_manager_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (OrgOfonoManagerSkeletonPrivate)); +#endif +} + +static void +org_ofono_manager_skeleton_iface_init (OrgOfonoManagerIface *iface) +{ + iface->modem_added = _org_ofono_manager_on_signal_modem_added; + iface->modem_removed = _org_ofono_manager_on_signal_modem_removed; +} + +/** + * org_ofono_manager_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.ofono.Manager. + * + * Returns: (transfer full) (type OrgOfonoManagerSkeleton): The skeleton object. + */ +OrgOfonoManager * +org_ofono_manager_skeleton_new (void) +{ + return ORG_OFONO_MANAGER (g_object_new (TYPE_ORG_OFONO_MANAGER_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:org-ofono-manager: + * + * The #OrgOfonoManager instance corresponding to the D-Bus interface org.ofono.Manager, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("org-ofono-manager", "org-ofono-manager", "org-ofono-manager", TYPE_ORG_OFONO_MANAGER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + +} + +/** + * object_get_org_ofono_manager: + * @object: A #Object. + * + * Gets the #OrgOfonoManager instance for the D-Bus interface org.ofono.Manager on @object, if any. + * + * Returns: (transfer full): A #OrgOfonoManager that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +OrgOfonoManager *object_get_org_ofono_manager (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.ofono.Manager"); + if (ret == NULL) + return NULL; + return ORG_OFONO_MANAGER (ret); +} + + +/** + * object_peek_org_ofono_manager: (skip) + * @object: A #Object. + * + * Like object_get_org_ofono_manager() but doesn't increase the reference count on the returned object. + * + * 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. + * + * Returns: (transfer none): A #OrgOfonoManager or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +OrgOfonoManager *object_peek_org_ofono_manager (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.ofono.Manager"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return ORG_OFONO_MANAGER (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.ofono.Manager"); + 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, "org-ofono-manager"); +} + +/** + * 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_ORG_OFONO_MANAGER (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.ofono.Manager"); + } + 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.ofono.Manager"); + 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, "org-ofono-manager"); +} + +/** + * 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_org_ofono_manager: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #OrgOfonoManager or %NULL to clear the interface. + * + * Sets the #OrgOfonoManager instance for the D-Bus interface org.ofono.Manager on @object. + */ +void object_skeleton_set_org_ofono_manager (ObjectSkeleton *object, OrgOfonoManager *interface_) +{ + g_object_set (G_OBJECT (object), "org-ofono-manager", 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.ofono.Manager", GSIZE_TO_POINTER (TYPE_ORG_OFONO_MANAGER_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 thread-default main loop 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 thread-default main loop 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; +} + + diff --git a/binding/gdbus/ofono_manager_interface.h b/binding/gdbus/ofono_manager_interface.h new file mode 100644 index 0000000..f8522c9 --- /dev/null +++ b/binding/gdbus/ofono_manager_interface.h @@ -0,0 +1,356 @@ +/* + * Generated by gdbus-codegen 2.50.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __OFONO_MANAGER_INTERFACE_H__ +#define __OFONO_MANAGER_INTERFACE_H__ + +#include + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.ofono.Manager */ + +#define TYPE_ORG_OFONO_MANAGER (org_ofono_manager_get_type ()) +#define ORG_OFONO_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_MANAGER, OrgOfonoManager)) +#define IS_ORG_OFONO_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_MANAGER)) +#define ORG_OFONO_MANAGER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_ORG_OFONO_MANAGER, OrgOfonoManagerIface)) + +struct _OrgOfonoManager; +typedef struct _OrgOfonoManager OrgOfonoManager; +typedef struct _OrgOfonoManagerIface OrgOfonoManagerIface; + +struct _OrgOfonoManagerIface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_get_modems) ( + OrgOfonoManager *object, + GDBusMethodInvocation *invocation); + + void (*modem_added) ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + + void (*modem_removed) ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0); + +}; + +GType org_ofono_manager_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *org_ofono_manager_interface_info (void); +guint org_ofono_manager_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void org_ofono_manager_complete_get_modems ( + OrgOfonoManager *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0); + + + +/* D-Bus signal emissions functions: */ +void org_ofono_manager_emit_modem_added ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + +void org_ofono_manager_emit_modem_removed ( + OrgOfonoManager *object, + const gchar *arg_unnamed_arg0); + + + +/* D-Bus method calls: */ +void org_ofono_manager_call_get_modems ( + OrgOfonoManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_manager_call_get_modems_finish ( + OrgOfonoManager *proxy, + GVariant **out_unnamed_arg0, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_manager_call_get_modems_sync ( + OrgOfonoManager *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error); + + + +/* ---- */ + +#define TYPE_ORG_OFONO_MANAGER_PROXY (org_ofono_manager_proxy_get_type ()) +#define ORG_OFONO_MANAGER_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_MANAGER_PROXY, OrgOfonoManagerProxy)) +#define ORG_OFONO_MANAGER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ORG_OFONO_MANAGER_PROXY, OrgOfonoManagerProxyClass)) +#define ORG_OFONO_MANAGER_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ORG_OFONO_MANAGER_PROXY, OrgOfonoManagerProxyClass)) +#define IS_ORG_OFONO_MANAGER_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_MANAGER_PROXY)) +#define IS_ORG_OFONO_MANAGER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ORG_OFONO_MANAGER_PROXY)) + +typedef struct _OrgOfonoManagerProxy OrgOfonoManagerProxy; +typedef struct _OrgOfonoManagerProxyClass OrgOfonoManagerProxyClass; +typedef struct _OrgOfonoManagerProxyPrivate OrgOfonoManagerProxyPrivate; + +struct _OrgOfonoManagerProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + OrgOfonoManagerProxyPrivate *priv; +}; + +struct _OrgOfonoManagerProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType org_ofono_manager_proxy_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OrgOfonoManagerProxy, g_object_unref) +#endif + +void org_ofono_manager_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +OrgOfonoManager *org_ofono_manager_proxy_new_finish ( + GAsyncResult *res, + GError **error); +OrgOfonoManager *org_ofono_manager_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void org_ofono_manager_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +OrgOfonoManager *org_ofono_manager_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +OrgOfonoManager *org_ofono_manager_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_ORG_OFONO_MANAGER_SKELETON (org_ofono_manager_skeleton_get_type ()) +#define ORG_OFONO_MANAGER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_MANAGER_SKELETON, OrgOfonoManagerSkeleton)) +#define ORG_OFONO_MANAGER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ORG_OFONO_MANAGER_SKELETON, OrgOfonoManagerSkeletonClass)) +#define ORG_OFONO_MANAGER_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ORG_OFONO_MANAGER_SKELETON, OrgOfonoManagerSkeletonClass)) +#define IS_ORG_OFONO_MANAGER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_MANAGER_SKELETON)) +#define IS_ORG_OFONO_MANAGER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ORG_OFONO_MANAGER_SKELETON)) + +typedef struct _OrgOfonoManagerSkeleton OrgOfonoManagerSkeleton; +typedef struct _OrgOfonoManagerSkeletonClass OrgOfonoManagerSkeletonClass; +typedef struct _OrgOfonoManagerSkeletonPrivate OrgOfonoManagerSkeletonPrivate; + +struct _OrgOfonoManagerSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + OrgOfonoManagerSkeletonPrivate *priv; +}; + +struct _OrgOfonoManagerSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType org_ofono_manager_skeleton_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OrgOfonoManagerSkeleton, g_object_unref) +#endif + +OrgOfonoManager *org_ofono_manager_skeleton_new (void); + + +/* ---- */ + +#define TYPE_OBJECT (object_get_type ()) +#define OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT, Object)) +#define IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT)) +#define OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_OBJECT, Object)) + +struct _Object; +typedef struct _Object Object; +typedef struct _ObjectIface ObjectIface; + +struct _ObjectIface +{ + GTypeInterface parent_iface; +}; + +GType object_get_type (void) G_GNUC_CONST; + +OrgOfonoManager *object_get_org_ofono_manager (Object *object); +OrgOfonoManager *object_peek_org_ofono_manager (Object *object); + +#define TYPE_OBJECT_PROXY (object_proxy_get_type ()) +#define OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_PROXY, ObjectProxy)) +#define OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_PROXY, ObjectProxyClass)) +#define OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_PROXY, ObjectProxyClass)) +#define IS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_PROXY)) +#define IS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_PROXY)) + +typedef struct _ObjectProxy ObjectProxy; +typedef struct _ObjectProxyClass ObjectProxyClass; +typedef struct _ObjectProxyPrivate ObjectProxyPrivate; + +struct _ObjectProxy +{ + /*< private >*/ + GDBusObjectProxy parent_instance; + ObjectProxyPrivate *priv; +}; + +struct _ObjectProxyClass +{ + GDBusObjectProxyClass parent_class; +}; + +GType object_proxy_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (ObjectProxy, g_object_unref) +#endif + +ObjectProxy *object_proxy_new (GDBusConnection *connection, const gchar *object_path); + +#define TYPE_OBJECT_SKELETON (object_skeleton_get_type ()) +#define OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_SKELETON, ObjectSkeleton)) +#define OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_SKELETON, ObjectSkeletonClass)) +#define OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_SKELETON, ObjectSkeletonClass)) +#define IS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_SKELETON)) +#define IS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_SKELETON)) + +typedef struct _ObjectSkeleton ObjectSkeleton; +typedef struct _ObjectSkeletonClass ObjectSkeletonClass; +typedef struct _ObjectSkeletonPrivate ObjectSkeletonPrivate; + +struct _ObjectSkeleton +{ + /*< private >*/ + GDBusObjectSkeleton parent_instance; + ObjectSkeletonPrivate *priv; +}; + +struct _ObjectSkeletonClass +{ + GDBusObjectSkeletonClass parent_class; +}; + +GType object_skeleton_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (ObjectSkeleton, g_object_unref) +#endif + +ObjectSkeleton *object_skeleton_new (const gchar *object_path); +void object_skeleton_set_org_ofono_manager (ObjectSkeleton *object, OrgOfonoManager *interface_); + +/* ---- */ + +#define TYPE_OBJECT_MANAGER_CLIENT (object_manager_client_get_type ()) +#define OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClient)) +#define OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClientClass)) +#define OBJECT_MANAGER_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClientClass)) +#define IS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_MANAGER_CLIENT)) +#define IS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_MANAGER_CLIENT)) + +typedef struct _ObjectManagerClient ObjectManagerClient; +typedef struct _ObjectManagerClientClass ObjectManagerClientClass; +typedef struct _ObjectManagerClientPrivate ObjectManagerClientPrivate; + +struct _ObjectManagerClient +{ + /*< private >*/ + GDBusObjectManagerClient parent_instance; + ObjectManagerClientPrivate *priv; +}; + +struct _ObjectManagerClientClass +{ + GDBusObjectManagerClientClass parent_class; +}; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (ObjectManagerClient, g_object_unref) +#endif + +GType object_manager_client_get_type (void) G_GNUC_CONST; + +GType object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager, const gchar *object_path, const gchar *interface_name, gpointer user_data); + +void object_manager_client_new ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager *object_manager_client_new_finish ( + GAsyncResult *res, + GError **error); +GDBusObjectManager *object_manager_client_new_sync ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +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); +GDBusObjectManager *object_manager_client_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GDBusObjectManager *object_manager_client_new_for_bus_sync ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +G_END_DECLS + +#endif /* __OFONO_MANAGER_INTERFACE_H__ */ diff --git a/binding/gdbus/ofono_voicecall.c b/binding/gdbus/ofono_voicecall.c new file mode 100644 index 0000000..cdc0da9 --- /dev/null +++ b/binding/gdbus/ofono_voicecall.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2017 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE + +#include +#include + +#define AFB_BINDING_VERSION 2 +#include + +#include "ofono_voicecall_interface.h" + +static void property_changed(OrgOfonoVoiceCall *voice_call, + gchar *property, + GVariant *value) +{ + GVariant *vvalue; + const gchar *state; + + if (!strcmp(property, "State")) { + vvalue = g_variant_get_variant(value); + state = g_variant_get_string(vvalue, NULL); + g_signal_emit_by_name(voice_call, "call-state-changed", state); + } +} + +OrgOfonoVoiceCall *ofono_voicecall_new(gchar *op, + void (*call_state_changed)(OrgOfonoVoiceCall *,gchar *)) +{ + OrgOfonoVoiceCall *voice_call; + + voice_call = org_ofono_voice_call_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, + "org.ofono", op, NULL, NULL); + + if (voice_call) { + g_signal_new("call-state-changed", + G_TYPE_OBJECT, + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, + G_TYPE_STRING); + + if (g_signal_connect(G_OBJECT(voice_call), "call-state-changed", G_CALLBACK(call_state_changed), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal call-state-changed\n"); + } + + if (g_signal_connect(voice_call, "property-changed", G_CALLBACK(property_changed), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal call-added\n"); + } + } + + return voice_call; +} + +void ofono_voicecall_free(OrgOfonoVoiceCall *voice_call) +{ + g_object_unref(G_OBJECT(voice_call)); +} + +void ofono_voicecall_hangup(OrgOfonoVoiceCall *voice_call) +{ + GError *error = NULL; + + org_ofono_voice_call_call_hangup_sync(voice_call, NULL, &error); +} + +void ofono_voicecall_answer(OrgOfonoVoiceCall *voice_call) +{ + GError *error = NULL; + + org_ofono_voice_call_call_answer_sync(voice_call, NULL, &error); +} diff --git a/binding/gdbus/ofono_voicecall.h b/binding/gdbus/ofono_voicecall.h new file mode 100644 index 0000000..dd3ff6d --- /dev/null +++ b/binding/gdbus/ofono_voicecall.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "ofono_voicecall_interface.h" + +OrgOfonoVoiceCall * +ofono_voicecall_new(gchar *, + void (*)(OrgOfonoVoiceCall *,gchar *)); +void ofono_voicecall_free(OrgOfonoVoiceCall *); +void ofono_voicecall_answer(OrgOfonoVoiceCall *); +void ofono_voicecall_hangup(OrgOfonoVoiceCall *); diff --git a/binding/gdbus/ofono_voicecall_interface.c b/binding/gdbus/ofono_voicecall_interface.c new file mode 100644 index 0000000..c5260b3 --- /dev/null +++ b/binding/gdbus/ofono_voicecall_interface.c @@ -0,0 +1,1895 @@ +/* + * Generated by gdbus-codegen 2.50.3. 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 "ofono_voicecall_interface.h" + +#include +#ifdef G_OS_UNIX +# include +#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.ofono.VoiceCall + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:OrgOfonoVoiceCall + * @title: OrgOfonoVoiceCall + * @short_description: Generated C code for the org.ofono.VoiceCall D-Bus interface + * + * This section contains code for working with the org.ofono.VoiceCall D-Bus interface in C. + */ + +/* ---- Introspection data for org.ofono.VoiceCall ---- */ + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_method_info_get_properties_OUT_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "a{sv}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_method_info_get_properties_OUT_ARG_pointers[] = +{ + &_org_ofono_voice_call_method_info_get_properties_OUT_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_method_info_get_properties = +{ + { + -1, + (gchar *) "GetProperties", + NULL, + (GDBusArgInfo **) &_org_ofono_voice_call_method_info_get_properties_OUT_ARG_pointers, + NULL + }, + "handle-get-properties", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_method_info_set_property_IN_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_method_info_set_property_IN_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "v", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_method_info_set_property_IN_ARG_pointers[] = +{ + &_org_ofono_voice_call_method_info_set_property_IN_ARG_unnamed_arg0, + &_org_ofono_voice_call_method_info_set_property_IN_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_method_info_set_property = +{ + { + -1, + (gchar *) "SetProperty", + (GDBusArgInfo **) &_org_ofono_voice_call_method_info_set_property_IN_ARG_pointers, + NULL, + NULL + }, + "handle-set-property", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_method_info_answer = +{ + { + -1, + (gchar *) "Answer", + NULL, + NULL, + NULL + }, + "handle-answer", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_method_info_hangup = +{ + { + -1, + (gchar *) "Hangup", + NULL, + NULL, + NULL + }, + "handle-hangup", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_method_info_deflect_IN_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_method_info_deflect_IN_ARG_pointers[] = +{ + &_org_ofono_voice_call_method_info_deflect_IN_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_method_info_deflect = +{ + { + -1, + (gchar *) "Deflect", + (GDBusArgInfo **) &_org_ofono_voice_call_method_info_deflect_IN_ARG_pointers, + NULL, + NULL + }, + "handle-deflect", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _org_ofono_voice_call_method_info_pointers[] = +{ + &_org_ofono_voice_call_method_info_get_properties, + &_org_ofono_voice_call_method_info_set_property, + &_org_ofono_voice_call_method_info_answer, + &_org_ofono_voice_call_method_info_hangup, + &_org_ofono_voice_call_method_info_deflect, + NULL +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_signal_info_property_changed_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_signal_info_property_changed_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "v", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_signal_info_property_changed_ARG_pointers[] = +{ + &_org_ofono_voice_call_signal_info_property_changed_ARG_unnamed_arg0, + &_org_ofono_voice_call_signal_info_property_changed_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_signal_info_property_changed = +{ + { + -1, + (gchar *) "PropertyChanged", + (GDBusArgInfo **) &_org_ofono_voice_call_signal_info_property_changed_ARG_pointers, + NULL + }, + "property-changed" +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_signal_info_disconnect_reason_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_signal_info_disconnect_reason_ARG_pointers[] = +{ + &_org_ofono_voice_call_signal_info_disconnect_reason_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_signal_info_disconnect_reason = +{ + { + -1, + (gchar *) "DisconnectReason", + (GDBusArgInfo **) &_org_ofono_voice_call_signal_info_disconnect_reason_ARG_pointers, + NULL + }, + "disconnect-reason" +}; + +static const _ExtendedGDBusSignalInfo * const _org_ofono_voice_call_signal_info_pointers[] = +{ + &_org_ofono_voice_call_signal_info_property_changed, + &_org_ofono_voice_call_signal_info_disconnect_reason, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _org_ofono_voice_call_interface_info = +{ + { + -1, + (gchar *) "org.ofono.VoiceCall", + (GDBusMethodInfo **) &_org_ofono_voice_call_method_info_pointers, + (GDBusSignalInfo **) &_org_ofono_voice_call_signal_info_pointers, + NULL, + NULL + }, + "org-ofono-voice-call", +}; + + +/** + * org_ofono_voice_call_interface_info: + * + * Gets a machine-readable description of the org.ofono.VoiceCall D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +org_ofono_voice_call_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_org_ofono_voice_call_interface_info.parent_struct; +} + +/** + * org_ofono_voice_call_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 #OrgOfonoVoiceCall interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +org_ofono_voice_call_override_properties (GObjectClass *klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + + + +/** + * OrgOfonoVoiceCall: + * + * Abstract interface type for the D-Bus interface org.ofono.VoiceCall. + */ + +/** + * OrgOfonoVoiceCallIface: + * @parent_iface: The parent interface. + * @handle_answer: Handler for the #OrgOfonoVoiceCall::handle-answer signal. + * @handle_deflect: Handler for the #OrgOfonoVoiceCall::handle-deflect signal. + * @handle_get_properties: Handler for the #OrgOfonoVoiceCall::handle-get-properties signal. + * @handle_hangup: Handler for the #OrgOfonoVoiceCall::handle-hangup signal. + * @handle_set_property: Handler for the #OrgOfonoVoiceCall::handle-set-property signal. + * @disconnect_reason: Handler for the #OrgOfonoVoiceCall::disconnect-reason signal. + * @property_changed: Handler for the #OrgOfonoVoiceCall::property-changed signal. + * + * Virtual table for the D-Bus interface org.ofono.VoiceCall. + */ + +typedef OrgOfonoVoiceCallIface OrgOfonoVoiceCallInterface; +G_DEFINE_INTERFACE (OrgOfonoVoiceCall, org_ofono_voice_call, G_TYPE_OBJECT); + +static void +org_ofono_voice_call_default_init (OrgOfonoVoiceCallIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * OrgOfonoVoiceCall::handle-get-properties: + * @object: A #OrgOfonoVoiceCall. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the GetProperties() 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 org_ofono_voice_call_complete_get_properties() 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-get-properties", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, handle_get_properties), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCall::handle-set-property: + * @object: A #OrgOfonoVoiceCall. + * @invocation: A #GDBusMethodInvocation. + * @arg_unnamed_arg0: Argument passed by remote caller. + * @arg_unnamed_arg1: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the SetProperty() 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 org_ofono_voice_call_complete_set_property() 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-set-property", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, handle_set_property), + 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); + + /** + * OrgOfonoVoiceCall::handle-answer: + * @object: A #OrgOfonoVoiceCall. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Answer() 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 org_ofono_voice_call_complete_answer() 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-answer", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, handle_answer), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCall::handle-hangup: + * @object: A #OrgOfonoVoiceCall. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Hangup() 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 org_ofono_voice_call_complete_hangup() 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-hangup", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, handle_hangup), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCall::handle-deflect: + * @object: A #OrgOfonoVoiceCall. + * @invocation: A #GDBusMethodInvocation. + * @arg_unnamed_arg0: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the Deflect() 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 org_ofono_voice_call_complete_deflect() 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-deflect", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, handle_deflect), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /* GObject signals for received D-Bus signals: */ + /** + * OrgOfonoVoiceCall::property-changed: + * @object: A #OrgOfonoVoiceCall. + * @arg_unnamed_arg0: Argument. + * @arg_unnamed_arg1: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "PropertyChanged" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("property-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, property_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * OrgOfonoVoiceCall::disconnect-reason: + * @object: A #OrgOfonoVoiceCall. + * @arg_unnamed_arg0: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "DisconnectReason" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("disconnect-reason", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallIface, disconnect_reason), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + +} + +/** + * org_ofono_voice_call_emit_property_changed: + * @object: A #OrgOfonoVoiceCall. + * @arg_unnamed_arg0: Argument to pass with the signal. + * @arg_unnamed_arg1: Argument to pass with the signal. + * + * Emits the "PropertyChanged" D-Bus signal. + */ +void +org_ofono_voice_call_emit_property_changed ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + g_signal_emit_by_name (object, "property-changed", arg_unnamed_arg0, arg_unnamed_arg1); +} + +/** + * org_ofono_voice_call_emit_disconnect_reason: + * @object: A #OrgOfonoVoiceCall. + * @arg_unnamed_arg0: Argument to pass with the signal. + * + * Emits the "DisconnectReason" D-Bus signal. + */ +void +org_ofono_voice_call_emit_disconnect_reason ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0) +{ + g_signal_emit_by_name (object, "disconnect-reason", arg_unnamed_arg0); +} + +/** + * org_ofono_voice_call_call_get_properties: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @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 GetProperties() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_call_get_properties_finish() to get the result of the operation. + * + * See org_ofono_voice_call_call_get_properties_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_call_get_properties ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetProperties", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_call_get_properties_finish: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_call_get_properties(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_call_get_properties(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_get_properties_finish ( + OrgOfonoVoiceCall *proxy, + GVariant **out_unnamed_arg0, + 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, + "(@a{sv})", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_call_get_properties_sync: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @out_unnamed_arg0: (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 GetProperties() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_call_get_properties() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_get_properties_sync ( + OrgOfonoVoiceCall *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetProperties", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a{sv})", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_call_set_property: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @arg_unnamed_arg1: 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 SetProperty() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_call_set_property_finish() to get the result of the operation. + * + * See org_ofono_voice_call_call_set_property_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_call_set_property ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SetProperty", + g_variant_new ("(s@v)", + arg_unnamed_arg0, + arg_unnamed_arg1), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_call_set_property_finish: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_call_set_property(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_call_set_property(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_set_property_finish ( + OrgOfonoVoiceCall *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; +} + +/** + * org_ofono_voice_call_call_set_property_sync: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @arg_unnamed_arg1: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the SetProperty() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_call_set_property() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_set_property_sync ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SetProperty", + g_variant_new ("(s@v)", + arg_unnamed_arg0, + arg_unnamed_arg1), + 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; +} + +/** + * org_ofono_voice_call_call_answer: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @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 Answer() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_call_answer_finish() to get the result of the operation. + * + * See org_ofono_voice_call_call_answer_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_call_answer ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Answer", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_call_answer_finish: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_call_answer(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_call_answer(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_answer_finish ( + OrgOfonoVoiceCall *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; +} + +/** + * org_ofono_voice_call_call_answer_sync: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Answer() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_call_answer() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_answer_sync ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Answer", + 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; +} + +/** + * org_ofono_voice_call_call_hangup: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @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 Hangup() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_call_hangup_finish() to get the result of the operation. + * + * See org_ofono_voice_call_call_hangup_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_call_hangup ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Hangup", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_call_hangup_finish: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_call_hangup(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_call_hangup(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_hangup_finish ( + OrgOfonoVoiceCall *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; +} + +/** + * org_ofono_voice_call_call_hangup_sync: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Hangup() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_call_hangup() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_hangup_sync ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Hangup", + 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; +} + +/** + * org_ofono_voice_call_call_deflect: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @arg_unnamed_arg0: 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 Deflect() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_call_deflect_finish() to get the result of the operation. + * + * See org_ofono_voice_call_call_deflect_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_call_deflect ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Deflect", + g_variant_new ("(s)", + arg_unnamed_arg0), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_call_deflect_finish: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_call_deflect(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_call_deflect(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_deflect_finish ( + OrgOfonoVoiceCall *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; +} + +/** + * org_ofono_voice_call_call_deflect_sync: + * @proxy: A #OrgOfonoVoiceCallProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Deflect() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_call_deflect() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_call_deflect_sync ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Deflect", + g_variant_new ("(s)", + arg_unnamed_arg0), + 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; +} + +/** + * org_ofono_voice_call_complete_get_properties: + * @object: A #OrgOfonoVoiceCall. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg0: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetProperties() 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 +org_ofono_voice_call_complete_get_properties ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@a{sv})", + unnamed_arg0)); +} + +/** + * org_ofono_voice_call_complete_set_property: + * @object: A #OrgOfonoVoiceCall. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the SetProperty() 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 +org_ofono_voice_call_complete_set_property ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_complete_answer: + * @object: A #OrgOfonoVoiceCall. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Answer() 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 +org_ofono_voice_call_complete_answer ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_complete_hangup: + * @object: A #OrgOfonoVoiceCall. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Hangup() 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 +org_ofono_voice_call_complete_hangup ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_complete_deflect: + * @object: A #OrgOfonoVoiceCall. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Deflect() 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 +org_ofono_voice_call_complete_deflect ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * OrgOfonoVoiceCallProxy: + * + * The #OrgOfonoVoiceCallProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * OrgOfonoVoiceCallProxyClass: + * @parent_class: The parent class. + * + * Class structure for #OrgOfonoVoiceCallProxy. + */ + +struct _OrgOfonoVoiceCallProxyPrivate +{ + GData *qdata; +}; + +static void org_ofono_voice_call_proxy_iface_init (OrgOfonoVoiceCallIface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallProxy, org_ofono_voice_call_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (OrgOfonoVoiceCallProxy) + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL, org_ofono_voice_call_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallProxy, org_ofono_voice_call_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL, org_ofono_voice_call_proxy_iface_init)); + +#endif +static void +org_ofono_voice_call_proxy_finalize (GObject *object) +{ + OrgOfonoVoiceCallProxy *proxy = ORG_OFONO_VOICE_CALL_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (org_ofono_voice_call_proxy_parent_class)->finalize (object); +} + +static void +org_ofono_voice_call_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ +} + +static void +org_ofono_voice_call_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ +} + +static void +org_ofono_voice_call_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 *) &_org_ofono_voice_call_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_ORG_OFONO_VOICE_CALL); + 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_ORG_OFONO_VOICE_CALL); + 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 +org_ofono_voice_call_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + OrgOfonoVoiceCallProxy *proxy = ORG_OFONO_VOICE_CALL_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 *) &_org_ofono_voice_call_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 *) &_org_ofono_voice_call_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 void +org_ofono_voice_call_proxy_init (OrgOfonoVoiceCallProxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = org_ofono_voice_call_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ORG_OFONO_VOICE_CALL_PROXY, OrgOfonoVoiceCallProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), org_ofono_voice_call_interface_info ()); +} + +static void +org_ofono_voice_call_proxy_class_init (OrgOfonoVoiceCallProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = org_ofono_voice_call_proxy_finalize; + gobject_class->get_property = org_ofono_voice_call_proxy_get_property; + gobject_class->set_property = org_ofono_voice_call_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = org_ofono_voice_call_proxy_g_signal; + proxy_class->g_properties_changed = org_ofono_voice_call_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (OrgOfonoVoiceCallProxyPrivate)); +#endif +} + +static void +org_ofono_voice_call_proxy_iface_init (OrgOfonoVoiceCallIface *iface) +{ +} + +/** + * org_ofono_voice_call_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 org.ofono.VoiceCall. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_proxy_new_finish() to get the result of the operation. + * + * See org_ofono_voice_call_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +org_ofono_voice_call_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_ORG_OFONO_VOICE_CALL_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.ofono.VoiceCall", NULL); +} + +/** + * org_ofono_voice_call_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with org_ofono_voice_call_proxy_new(). + * + * Returns: (transfer full) (type OrgOfonoVoiceCallProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCall * +org_ofono_voice_call_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 ORG_OFONO_VOICE_CALL (ret); + else + return NULL; +} + +/** + * org_ofono_voice_call_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 org.ofono.VoiceCall. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type OrgOfonoVoiceCallProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCall * +org_ofono_voice_call_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_ORG_OFONO_VOICE_CALL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.ofono.VoiceCall", NULL); + if (ret != NULL) + return ORG_OFONO_VOICE_CALL (ret); + else + return NULL; +} + + +/** + * org_ofono_voice_call_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 org_ofono_voice_call_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_proxy_new_for_bus_finish() to get the result of the operation. + * + * See org_ofono_voice_call_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +org_ofono_voice_call_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_ORG_OFONO_VOICE_CALL_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.ofono.VoiceCall", NULL); +} + +/** + * org_ofono_voice_call_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with org_ofono_voice_call_proxy_new_for_bus(). + * + * Returns: (transfer full) (type OrgOfonoVoiceCallProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCall * +org_ofono_voice_call_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 ORG_OFONO_VOICE_CALL (ret); + else + return NULL; +} + +/** + * org_ofono_voice_call_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 org_ofono_voice_call_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type OrgOfonoVoiceCallProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCall * +org_ofono_voice_call_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_ORG_OFONO_VOICE_CALL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.ofono.VoiceCall", NULL); + if (ret != NULL) + return ORG_OFONO_VOICE_CALL (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * OrgOfonoVoiceCallSkeleton: + * + * The #OrgOfonoVoiceCallSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * OrgOfonoVoiceCallSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #OrgOfonoVoiceCallSkeleton. + */ + +struct _OrgOfonoVoiceCallSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_org_ofono_voice_call_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) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_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_ORG_OFONO_VOICE_CALL); + 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_ORG_OFONO_VOICE_CALL); + 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 * +_org_ofono_voice_call_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) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_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 *) &_org_ofono_voice_call_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 +_org_ofono_voice_call_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) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_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 *) &_org_ofono_voice_call_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 _org_ofono_voice_call_skeleton_vtable = +{ + _org_ofono_voice_call_skeleton_handle_method_call, + _org_ofono_voice_call_skeleton_handle_get_property, + _org_ofono_voice_call_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +org_ofono_voice_call_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return org_ofono_voice_call_interface_info (); +} + +static GDBusInterfaceVTable * +org_ofono_voice_call_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_org_ofono_voice_call_skeleton_vtable; +} + +static GVariant * +org_ofono_voice_call_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_org_ofono_voice_call_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _org_ofono_voice_call_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _org_ofono_voice_call_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _org_ofono_voice_call_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.ofono.VoiceCall", 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 void +org_ofono_voice_call_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ +} + +static void +_org_ofono_voice_call_on_signal_property_changed ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s@v)", + arg_unnamed_arg0, + arg_unnamed_arg1)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCall", "PropertyChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_org_ofono_voice_call_on_signal_disconnect_reason ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s)", + arg_unnamed_arg0)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCall", "DisconnectReason", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void org_ofono_voice_call_skeleton_iface_init (OrgOfonoVoiceCallIface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallSkeleton, org_ofono_voice_call_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (OrgOfonoVoiceCallSkeleton) + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL, org_ofono_voice_call_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallSkeleton, org_ofono_voice_call_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL, org_ofono_voice_call_skeleton_iface_init)); + +#endif +static void +org_ofono_voice_call_skeleton_finalize (GObject *object) +{ + OrgOfonoVoiceCallSkeleton *skeleton = ORG_OFONO_VOICE_CALL_SKELETON (object); + 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 (org_ofono_voice_call_skeleton_parent_class)->finalize (object); +} + +static void +org_ofono_voice_call_skeleton_init (OrgOfonoVoiceCallSkeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = org_ofono_voice_call_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ORG_OFONO_VOICE_CALL_SKELETON, OrgOfonoVoiceCallSkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); +} + +static void +org_ofono_voice_call_skeleton_class_init (OrgOfonoVoiceCallSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = org_ofono_voice_call_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = org_ofono_voice_call_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = org_ofono_voice_call_skeleton_dbus_interface_get_properties; + skeleton_class->flush = org_ofono_voice_call_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = org_ofono_voice_call_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (OrgOfonoVoiceCallSkeletonPrivate)); +#endif +} + +static void +org_ofono_voice_call_skeleton_iface_init (OrgOfonoVoiceCallIface *iface) +{ + iface->property_changed = _org_ofono_voice_call_on_signal_property_changed; + iface->disconnect_reason = _org_ofono_voice_call_on_signal_disconnect_reason; +} + +/** + * org_ofono_voice_call_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.ofono.VoiceCall. + * + * Returns: (transfer full) (type OrgOfonoVoiceCallSkeleton): The skeleton object. + */ +OrgOfonoVoiceCall * +org_ofono_voice_call_skeleton_new (void) +{ + return ORG_OFONO_VOICE_CALL (g_object_new (TYPE_ORG_OFONO_VOICE_CALL_SKELETON, NULL)); +} + diff --git a/binding/gdbus/ofono_voicecall_interface.h b/binding/gdbus/ofono_voicecall_interface.h new file mode 100644 index 0000000..883df40 --- /dev/null +++ b/binding/gdbus/ofono_voicecall_interface.h @@ -0,0 +1,305 @@ +/* + * Generated by gdbus-codegen 2.50.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __OFONO_VOICECALL_INTERFACE_H__ +#define __OFONO_VOICECALL_INTERFACE_H__ + +#include + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.ofono.VoiceCall */ + +#define TYPE_ORG_OFONO_VOICE_CALL (org_ofono_voice_call_get_type ()) +#define ORG_OFONO_VOICE_CALL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_VOICE_CALL, OrgOfonoVoiceCall)) +#define IS_ORG_OFONO_VOICE_CALL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_VOICE_CALL)) +#define ORG_OFONO_VOICE_CALL_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_ORG_OFONO_VOICE_CALL, OrgOfonoVoiceCallIface)) + +struct _OrgOfonoVoiceCall; +typedef struct _OrgOfonoVoiceCall OrgOfonoVoiceCall; +typedef struct _OrgOfonoVoiceCallIface OrgOfonoVoiceCallIface; + +struct _OrgOfonoVoiceCallIface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_answer) ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_deflect) ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation, + const gchar *arg_unnamed_arg0); + + gboolean (*handle_get_properties) ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_hangup) ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_set_property) ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + + void (*disconnect_reason) ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0); + + void (*property_changed) ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + +}; + +GType org_ofono_voice_call_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *org_ofono_voice_call_interface_info (void); +guint org_ofono_voice_call_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void org_ofono_voice_call_complete_get_properties ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0); + +void org_ofono_voice_call_complete_set_property ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_complete_answer ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_complete_hangup ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_complete_deflect ( + OrgOfonoVoiceCall *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void org_ofono_voice_call_emit_property_changed ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + +void org_ofono_voice_call_emit_disconnect_reason ( + OrgOfonoVoiceCall *object, + const gchar *arg_unnamed_arg0); + + + +/* D-Bus method calls: */ +void org_ofono_voice_call_call_get_properties ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_call_get_properties_finish ( + OrgOfonoVoiceCall *proxy, + GVariant **out_unnamed_arg0, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_call_get_properties_sync ( + OrgOfonoVoiceCall *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_call_set_property ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_call_set_property_finish ( + OrgOfonoVoiceCall *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_call_set_property_sync ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_call_answer ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_call_answer_finish ( + OrgOfonoVoiceCall *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_call_answer_sync ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_call_hangup ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_call_hangup_finish ( + OrgOfonoVoiceCall *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_call_hangup_sync ( + OrgOfonoVoiceCall *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_call_deflect ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_call_deflect_finish ( + OrgOfonoVoiceCall *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_call_deflect_sync ( + OrgOfonoVoiceCall *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GError **error); + + + +/* ---- */ + +#define TYPE_ORG_OFONO_VOICE_CALL_PROXY (org_ofono_voice_call_proxy_get_type ()) +#define ORG_OFONO_VOICE_CALL_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_VOICE_CALL_PROXY, OrgOfonoVoiceCallProxy)) +#define ORG_OFONO_VOICE_CALL_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ORG_OFONO_VOICE_CALL_PROXY, OrgOfonoVoiceCallProxyClass)) +#define ORG_OFONO_VOICE_CALL_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ORG_OFONO_VOICE_CALL_PROXY, OrgOfonoVoiceCallProxyClass)) +#define IS_ORG_OFONO_VOICE_CALL_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_VOICE_CALL_PROXY)) +#define IS_ORG_OFONO_VOICE_CALL_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ORG_OFONO_VOICE_CALL_PROXY)) + +typedef struct _OrgOfonoVoiceCallProxy OrgOfonoVoiceCallProxy; +typedef struct _OrgOfonoVoiceCallProxyClass OrgOfonoVoiceCallProxyClass; +typedef struct _OrgOfonoVoiceCallProxyPrivate OrgOfonoVoiceCallProxyPrivate; + +struct _OrgOfonoVoiceCallProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + OrgOfonoVoiceCallProxyPrivate *priv; +}; + +struct _OrgOfonoVoiceCallProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType org_ofono_voice_call_proxy_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OrgOfonoVoiceCallProxy, g_object_unref) +#endif + +void org_ofono_voice_call_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +OrgOfonoVoiceCall *org_ofono_voice_call_proxy_new_finish ( + GAsyncResult *res, + GError **error); +OrgOfonoVoiceCall *org_ofono_voice_call_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +OrgOfonoVoiceCall *org_ofono_voice_call_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +OrgOfonoVoiceCall *org_ofono_voice_call_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_ORG_OFONO_VOICE_CALL_SKELETON (org_ofono_voice_call_skeleton_get_type ()) +#define ORG_OFONO_VOICE_CALL_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_VOICE_CALL_SKELETON, OrgOfonoVoiceCallSkeleton)) +#define ORG_OFONO_VOICE_CALL_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ORG_OFONO_VOICE_CALL_SKELETON, OrgOfonoVoiceCallSkeletonClass)) +#define ORG_OFONO_VOICE_CALL_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ORG_OFONO_VOICE_CALL_SKELETON, OrgOfonoVoiceCallSkeletonClass)) +#define IS_ORG_OFONO_VOICE_CALL_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_VOICE_CALL_SKELETON)) +#define IS_ORG_OFONO_VOICE_CALL_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ORG_OFONO_VOICE_CALL_SKELETON)) + +typedef struct _OrgOfonoVoiceCallSkeleton OrgOfonoVoiceCallSkeleton; +typedef struct _OrgOfonoVoiceCallSkeletonClass OrgOfonoVoiceCallSkeletonClass; +typedef struct _OrgOfonoVoiceCallSkeletonPrivate OrgOfonoVoiceCallSkeletonPrivate; + +struct _OrgOfonoVoiceCallSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + OrgOfonoVoiceCallSkeletonPrivate *priv; +}; + +struct _OrgOfonoVoiceCallSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType org_ofono_voice_call_skeleton_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OrgOfonoVoiceCallSkeleton, g_object_unref) +#endif + +OrgOfonoVoiceCall *org_ofono_voice_call_skeleton_new (void); + + +G_END_DECLS + +#endif /* __OFONO_VOICECALL_INTERFACE_H__ */ diff --git a/binding/gdbus/ofono_voicecallmanager.c b/binding/gdbus/ofono_voicecallmanager.c new file mode 100644 index 0000000..956bcba --- /dev/null +++ b/binding/gdbus/ofono_voicecallmanager.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2017 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE + +#include + +#define AFB_BINDING_VERSION 2 +#include + +#include "ofono_voicecallmanager_interface.h" + +static void call_added(OrgOfonoVoiceCallManager *manager, + gchar *op, + GVariant *properties) +{ + GVariantIter *iter; + gchar *key; + GVariant *value; + const gchar *state = NULL, *cl = NULL; + + g_variant_get(properties, "a{sv}", &iter); + while (g_variant_iter_loop(iter, "{sv}", &key, &value)) { + if (!strcmp(key, "State")) { + state = g_variant_get_string(value, NULL); + } else if (!strcmp(key, "LineIdentification")) { + cl = g_variant_get_string(value, NULL); + } + } + + if (!strcmp(state, "incoming")) { + g_signal_emit_by_name(manager, "incoming-call", op, cl ? cl : ""); + } else if (!strcmp(state, "dialing")) { + g_signal_emit_by_name(manager, "dialing-call", op, cl ? cl : ""); + } +} + +static void call_removed(OrgOfonoVoiceCallManager *manager, + gchar *op, + GVariant *properties) +{ + g_signal_emit_by_name(manager, "terminated-call", op); +} + +const OrgOfonoVoiceCallManager +*ofono_voicecallmanager_init(const gchar *op, + void (*incoming_call)(OrgOfonoVoiceCallManager *manager,gchar *,gchar *), + void (*dialing_call)(OrgOfonoVoiceCallManager *manager,gchar *,gchar *), + void (*terminated_call)(OrgOfonoVoiceCallManager *manager,gchar *)) +{ + OrgOfonoVoiceCallManager *manager = org_ofono_voice_call_manager_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, + "org.ofono", op, NULL, NULL); + + g_signal_new("incoming-call", + G_TYPE_OBJECT, + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_TYPE_STRING); + + g_signal_new("dialing-call", + G_TYPE_OBJECT, + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_TYPE_STRING); + + g_signal_new("terminated-call", + G_TYPE_OBJECT, + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, + G_TYPE_STRING); + + if (g_signal_connect(G_OBJECT(manager), "incoming-call", G_CALLBACK(incoming_call), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal incoming-call\n"); + } + + if (g_signal_connect(G_OBJECT(manager), "dialing-call", G_CALLBACK(dialing_call), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal dialing-call\n"); + } + + if (g_signal_connect(G_OBJECT(manager), "terminated-call", G_CALLBACK(terminated_call), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal terminated-call\n"); + } + + if (g_signal_connect(manager, "call-added", G_CALLBACK(call_added), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal call-added\n"); + } + + if (g_signal_connect(manager, "call-removed", G_CALLBACK(call_removed), NULL) <= 0) { + AFB_ERROR("Failed to connect to signal call-removed\n"); + } + + return manager; +} + +void ofono_voicecallmanager_free(OrgOfonoVoiceCallManager *vcm) +{ + g_object_unref(G_OBJECT(vcm)); +} + +gchar *ofono_voicecallmanager_dial(OrgOfonoVoiceCallManager *manager, + const gchar *number, + const gchar *cid) +{ + gchar *out = NULL; + GError *error = NULL; + + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return NULL; + } + + org_ofono_voice_call_manager_call_dial_sync(manager, number, cid, &out, NULL, &error); + if (error != NULL) + out = NULL; + + return out; +} + +void ofono_voicecallmanager_hangup_all(OrgOfonoVoiceCallManager *manager) +{ + GError *error = NULL; + + if (!manager) { + AFB_ERROR("Ofono VoiceCallmanager uninitialized\n"); + return; + } + + org_ofono_voice_call_manager_call_hangup_all_sync(manager, NULL, &error); +} diff --git a/binding/gdbus/ofono_voicecallmanager.h b/binding/gdbus/ofono_voicecallmanager.h new file mode 100644 index 0000000..81e4bb6 --- /dev/null +++ b/binding/gdbus/ofono_voicecallmanager.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2017 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "ofono_voicecallmanager_interface.h" + +OrgOfonoVoiceCallManager +*ofono_voicecallmanager_init(const gchar *, + void(*)(OrgOfonoVoiceCallManager *, gchar *, gchar *), + void(*)(OrgOfonoVoiceCallManager *, gchar *, gchar *), + void(*)(OrgOfonoVoiceCallManager *, gchar *)); +void ofono_voicecallmanager_free(OrgOfonoVoiceCallManager *); +gchar *ofono_voicecallmanager_dial(OrgOfonoVoiceCallManager *, gchar *, gchar *); +void ofono_hangup_all(OrgOfonoVoiceCallManager *); diff --git a/binding/gdbus/ofono_voicecallmanager_interface.c b/binding/gdbus/ofono_voicecallmanager_interface.c new file mode 100644 index 0000000..88c86da --- /dev/null +++ b/binding/gdbus/ofono_voicecallmanager_interface.c @@ -0,0 +1,3336 @@ +/* + * Generated by gdbus-codegen 2.50.3. 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 "ofono_voicecallmanager_interface.h" + +#include +#ifdef G_OS_UNIX +# include +#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.ofono.VoiceCallManager + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:OrgOfonoVoiceCallManager + * @title: OrgOfonoVoiceCallManager + * @short_description: Generated C code for the org.ofono.VoiceCallManager D-Bus interface + * + * This section contains code for working with the org.ofono.VoiceCallManager D-Bus interface in C. + */ + +/* ---- Introspection data for org.ofono.VoiceCallManager ---- */ + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_get_properties_OUT_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "a{sv}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_get_properties_OUT_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_get_properties_OUT_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_get_properties = +{ + { + -1, + (gchar *) "GetProperties", + NULL, + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_get_properties_OUT_ARG_pointers, + NULL + }, + "handle-get-properties", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_dial_IN_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_dial_IN_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_dial_IN_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_dial_IN_ARG_unnamed_arg0, + &_org_ofono_voice_call_manager_method_info_dial_IN_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_dial_OUT_ARG_unnamed_arg2 = +{ + { + -1, + (gchar *) "unnamed_arg2", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_dial_OUT_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_dial_OUT_ARG_unnamed_arg2, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_dial = +{ + { + -1, + (gchar *) "Dial", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_dial_IN_ARG_pointers, + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_dial_OUT_ARG_pointers, + NULL + }, + "handle-dial", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_transfer = +{ + { + -1, + (gchar *) "Transfer", + NULL, + NULL, + NULL + }, + "handle-transfer", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_swap_calls = +{ + { + -1, + (gchar *) "SwapCalls", + NULL, + NULL, + NULL + }, + "handle-swap-calls", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_release_and_answer = +{ + { + -1, + (gchar *) "ReleaseAndAnswer", + NULL, + NULL, + NULL + }, + "handle-release-and-answer", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_hold_and_answer = +{ + { + -1, + (gchar *) "HoldAndAnswer", + NULL, + NULL, + NULL + }, + "handle-hold-and-answer", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_hangup_all = +{ + { + -1, + (gchar *) "HangupAll", + NULL, + NULL, + NULL + }, + "handle-hangup-all", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_private_chat_IN_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_private_chat_IN_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_private_chat_IN_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_private_chat_OUT_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_private_chat_OUT_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_private_chat_OUT_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_private_chat = +{ + { + -1, + (gchar *) "PrivateChat", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_private_chat_IN_ARG_pointers, + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_private_chat_OUT_ARG_pointers, + NULL + }, + "handle-private-chat", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_create_multiparty_OUT_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "ao", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_create_multiparty_OUT_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_create_multiparty_OUT_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_create_multiparty = +{ + { + -1, + (gchar *) "CreateMultiparty", + NULL, + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_create_multiparty_OUT_ARG_pointers, + NULL + }, + "handle-create-multiparty", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_hangup_multiparty = +{ + { + -1, + (gchar *) "HangupMultiparty", + NULL, + NULL, + NULL + }, + "handle-hangup-multiparty", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_send_tones_IN_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_send_tones_IN_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_send_tones_IN_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_send_tones = +{ + { + -1, + (gchar *) "SendTones", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_send_tones_IN_ARG_pointers, + NULL, + NULL + }, + "handle-send-tones", + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_method_info_get_calls_OUT_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "a(oa{sv})", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_method_info_get_calls_OUT_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_get_calls_OUT_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusMethodInfo _org_ofono_voice_call_manager_method_info_get_calls = +{ + { + -1, + (gchar *) "GetCalls", + NULL, + (GDBusArgInfo **) &_org_ofono_voice_call_manager_method_info_get_calls_OUT_ARG_pointers, + NULL + }, + "handle-get-calls", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _org_ofono_voice_call_manager_method_info_pointers[] = +{ + &_org_ofono_voice_call_manager_method_info_get_properties, + &_org_ofono_voice_call_manager_method_info_dial, + &_org_ofono_voice_call_manager_method_info_transfer, + &_org_ofono_voice_call_manager_method_info_swap_calls, + &_org_ofono_voice_call_manager_method_info_release_and_answer, + &_org_ofono_voice_call_manager_method_info_hold_and_answer, + &_org_ofono_voice_call_manager_method_info_hangup_all, + &_org_ofono_voice_call_manager_method_info_private_chat, + &_org_ofono_voice_call_manager_method_info_create_multiparty, + &_org_ofono_voice_call_manager_method_info_hangup_multiparty, + &_org_ofono_voice_call_manager_method_info_send_tones, + &_org_ofono_voice_call_manager_method_info_get_calls, + NULL +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_property_changed_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_property_changed_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "v", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_signal_info_property_changed_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_signal_info_property_changed_ARG_unnamed_arg0, + &_org_ofono_voice_call_manager_signal_info_property_changed_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_manager_signal_info_property_changed = +{ + { + -1, + (gchar *) "PropertyChanged", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_signal_info_property_changed_ARG_pointers, + NULL + }, + "property-changed" +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_call_added_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_call_added_ARG_unnamed_arg1 = +{ + { + -1, + (gchar *) "unnamed_arg1", + (gchar *) "a{sv}", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_signal_info_call_added_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_signal_info_call_added_ARG_unnamed_arg0, + &_org_ofono_voice_call_manager_signal_info_call_added_ARG_unnamed_arg1, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_manager_signal_info_call_added = +{ + { + -1, + (gchar *) "CallAdded", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_signal_info_call_added_ARG_pointers, + NULL + }, + "call-added" +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_call_removed_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_signal_info_call_removed_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_signal_info_call_removed_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_manager_signal_info_call_removed = +{ + { + -1, + (gchar *) "CallRemoved", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_signal_info_call_removed_ARG_pointers, + NULL + }, + "call-removed" +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_barring_active_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_signal_info_barring_active_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_signal_info_barring_active_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_manager_signal_info_barring_active = +{ + { + -1, + (gchar *) "BarringActive", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_signal_info_barring_active_ARG_pointers, + NULL + }, + "barring-active" +}; + +static const _ExtendedGDBusArgInfo _org_ofono_voice_call_manager_signal_info_forwarded_ARG_unnamed_arg0 = +{ + { + -1, + (gchar *) "unnamed_arg0", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _org_ofono_voice_call_manager_signal_info_forwarded_ARG_pointers[] = +{ + &_org_ofono_voice_call_manager_signal_info_forwarded_ARG_unnamed_arg0, + NULL +}; + +static const _ExtendedGDBusSignalInfo _org_ofono_voice_call_manager_signal_info_forwarded = +{ + { + -1, + (gchar *) "Forwarded", + (GDBusArgInfo **) &_org_ofono_voice_call_manager_signal_info_forwarded_ARG_pointers, + NULL + }, + "forwarded" +}; + +static const _ExtendedGDBusSignalInfo * const _org_ofono_voice_call_manager_signal_info_pointers[] = +{ + &_org_ofono_voice_call_manager_signal_info_property_changed, + &_org_ofono_voice_call_manager_signal_info_call_added, + &_org_ofono_voice_call_manager_signal_info_call_removed, + &_org_ofono_voice_call_manager_signal_info_barring_active, + &_org_ofono_voice_call_manager_signal_info_forwarded, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _org_ofono_voice_call_manager_interface_info = +{ + { + -1, + (gchar *) "org.ofono.VoiceCallManager", + (GDBusMethodInfo **) &_org_ofono_voice_call_manager_method_info_pointers, + (GDBusSignalInfo **) &_org_ofono_voice_call_manager_signal_info_pointers, + NULL, + NULL + }, + "org-ofono-voice-call-manager", +}; + + +/** + * org_ofono_voice_call_manager_interface_info: + * + * Gets a machine-readable description of the org.ofono.VoiceCallManager D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +org_ofono_voice_call_manager_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_org_ofono_voice_call_manager_interface_info.parent_struct; +} + +/** + * org_ofono_voice_call_manager_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 #OrgOfonoVoiceCallManager interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +org_ofono_voice_call_manager_override_properties (GObjectClass *klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + + + +/** + * OrgOfonoVoiceCallManager: + * + * Abstract interface type for the D-Bus interface org.ofono.VoiceCallManager. + */ + +/** + * OrgOfonoVoiceCallManagerIface: + * @parent_iface: The parent interface. + * @handle_create_multiparty: Handler for the #OrgOfonoVoiceCallManager::handle-create-multiparty signal. + * @handle_dial: Handler for the #OrgOfonoVoiceCallManager::handle-dial signal. + * @handle_get_calls: Handler for the #OrgOfonoVoiceCallManager::handle-get-calls signal. + * @handle_get_properties: Handler for the #OrgOfonoVoiceCallManager::handle-get-properties signal. + * @handle_hangup_all: Handler for the #OrgOfonoVoiceCallManager::handle-hangup-all signal. + * @handle_hangup_multiparty: Handler for the #OrgOfonoVoiceCallManager::handle-hangup-multiparty signal. + * @handle_hold_and_answer: Handler for the #OrgOfonoVoiceCallManager::handle-hold-and-answer signal. + * @handle_private_chat: Handler for the #OrgOfonoVoiceCallManager::handle-private-chat signal. + * @handle_release_and_answer: Handler for the #OrgOfonoVoiceCallManager::handle-release-and-answer signal. + * @handle_send_tones: Handler for the #OrgOfonoVoiceCallManager::handle-send-tones signal. + * @handle_swap_calls: Handler for the #OrgOfonoVoiceCallManager::handle-swap-calls signal. + * @handle_transfer: Handler for the #OrgOfonoVoiceCallManager::handle-transfer signal. + * @barring_active: Handler for the #OrgOfonoVoiceCallManager::barring-active signal. + * @call_added: Handler for the #OrgOfonoVoiceCallManager::call-added signal. + * @call_removed: Handler for the #OrgOfonoVoiceCallManager::call-removed signal. + * @forwarded: Handler for the #OrgOfonoVoiceCallManager::forwarded signal. + * @property_changed: Handler for the #OrgOfonoVoiceCallManager::property-changed signal. + * + * Virtual table for the D-Bus interface org.ofono.VoiceCallManager. + */ + +typedef OrgOfonoVoiceCallManagerIface OrgOfonoVoiceCallManagerInterface; +G_DEFINE_INTERFACE (OrgOfonoVoiceCallManager, org_ofono_voice_call_manager, G_TYPE_OBJECT); + +static void +org_ofono_voice_call_manager_default_init (OrgOfonoVoiceCallManagerIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * OrgOfonoVoiceCallManager::handle-get-properties: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the GetProperties() 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 org_ofono_voice_call_manager_complete_get_properties() 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-get-properties", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_get_properties), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-dial: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_unnamed_arg0: Argument passed by remote caller. + * @arg_unnamed_arg1: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the Dial() 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 org_ofono_voice_call_manager_complete_dial() 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-dial", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_dial), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 3, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); + + /** + * OrgOfonoVoiceCallManager::handle-transfer: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Transfer() 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 org_ofono_voice_call_manager_complete_transfer() 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-transfer", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_transfer), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-swap-calls: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the SwapCalls() 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 org_ofono_voice_call_manager_complete_swap_calls() 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-swap-calls", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_swap_calls), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-release-and-answer: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the ReleaseAndAnswer() 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 org_ofono_voice_call_manager_complete_release_and_answer() 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-and-answer", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_release_and_answer), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-hold-and-answer: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the HoldAndAnswer() 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 org_ofono_voice_call_manager_complete_hold_and_answer() 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-hold-and-answer", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_hold_and_answer), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-hangup-all: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the HangupAll() 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 org_ofono_voice_call_manager_complete_hangup_all() 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-hangup-all", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_hangup_all), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-private-chat: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_unnamed_arg0: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the PrivateChat() 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 org_ofono_voice_call_manager_complete_private_chat() 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-private-chat", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_private_chat), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * OrgOfonoVoiceCallManager::handle-create-multiparty: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the CreateMultiparty() 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 org_ofono_voice_call_manager_complete_create_multiparty() 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-create-multiparty", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_create_multiparty), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-hangup-multiparty: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the HangupMultiparty() 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 org_ofono_voice_call_manager_complete_hangup_multiparty() 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-hangup-multiparty", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_hangup_multiparty), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * OrgOfonoVoiceCallManager::handle-send-tones: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * @arg_unnamed_arg0: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the SendTones() 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 org_ofono_voice_call_manager_complete_send_tones() 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-send-tones", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_send_tones), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * OrgOfonoVoiceCallManager::handle-get-calls: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the GetCalls() 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 org_ofono_voice_call_manager_complete_get_calls() 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-get-calls", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, handle_get_calls), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject signals for received D-Bus signals: */ + /** + * OrgOfonoVoiceCallManager::property-changed: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument. + * @arg_unnamed_arg1: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "PropertyChanged" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("property-changed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, property_changed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * OrgOfonoVoiceCallManager::call-added: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument. + * @arg_unnamed_arg1: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "CallAdded" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("call-added", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, call_added), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * OrgOfonoVoiceCallManager::call-removed: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "CallRemoved" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("call-removed", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, call_removed), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * OrgOfonoVoiceCallManager::barring-active: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "BarringActive" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("barring-active", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, barring_active), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + /** + * OrgOfonoVoiceCallManager::forwarded: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "Forwarded" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("forwarded", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (OrgOfonoVoiceCallManagerIface, forwarded), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_STRING); + +} + +/** + * org_ofono_voice_call_manager_emit_property_changed: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * @arg_unnamed_arg1: Argument to pass with the signal. + * + * Emits the "PropertyChanged" D-Bus signal. + */ +void +org_ofono_voice_call_manager_emit_property_changed ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + g_signal_emit_by_name (object, "property-changed", arg_unnamed_arg0, arg_unnamed_arg1); +} + +/** + * org_ofono_voice_call_manager_emit_call_added: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * @arg_unnamed_arg1: Argument to pass with the signal. + * + * Emits the "CallAdded" D-Bus signal. + */ +void +org_ofono_voice_call_manager_emit_call_added ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + g_signal_emit_by_name (object, "call-added", arg_unnamed_arg0, arg_unnamed_arg1); +} + +/** + * org_ofono_voice_call_manager_emit_call_removed: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * + * Emits the "CallRemoved" D-Bus signal. + */ +void +org_ofono_voice_call_manager_emit_call_removed ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0) +{ + g_signal_emit_by_name (object, "call-removed", arg_unnamed_arg0); +} + +/** + * org_ofono_voice_call_manager_emit_barring_active: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * + * Emits the "BarringActive" D-Bus signal. + */ +void +org_ofono_voice_call_manager_emit_barring_active ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0) +{ + g_signal_emit_by_name (object, "barring-active", arg_unnamed_arg0); +} + +/** + * org_ofono_voice_call_manager_emit_forwarded: + * @object: A #OrgOfonoVoiceCallManager. + * @arg_unnamed_arg0: Argument to pass with the signal. + * + * Emits the "Forwarded" D-Bus signal. + */ +void +org_ofono_voice_call_manager_emit_forwarded ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0) +{ + g_signal_emit_by_name (object, "forwarded", arg_unnamed_arg0); +} + +/** + * org_ofono_voice_call_manager_call_get_properties: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 GetProperties() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_get_properties_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_get_properties_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_get_properties ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetProperties", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_get_properties_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_get_properties(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_get_properties(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_get_properties_finish ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + 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, + "(@a{sv})", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_get_properties_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg0: (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 GetProperties() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_get_properties() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_get_properties_sync ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetProperties", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a{sv})", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_dial: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @arg_unnamed_arg1: 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 Dial() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_dial_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_dial_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_dial ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + const gchar *arg_unnamed_arg1, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Dial", + g_variant_new ("(ss)", + arg_unnamed_arg0, + arg_unnamed_arg1), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_dial_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg2: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_dial(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_dial(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_dial_finish ( + OrgOfonoVoiceCallManager *proxy, + gchar **out_unnamed_arg2, + 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, + "(o)", + out_unnamed_arg2); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_dial_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @arg_unnamed_arg1: Argument to pass with the method invocation. + * @out_unnamed_arg2: (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 Dial() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_dial() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_dial_sync ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + const gchar *arg_unnamed_arg1, + gchar **out_unnamed_arg2, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Dial", + g_variant_new ("(ss)", + arg_unnamed_arg0, + arg_unnamed_arg1), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(o)", + out_unnamed_arg2); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_transfer: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 Transfer() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_transfer_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_transfer_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_transfer ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Transfer", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_transfer_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_transfer(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_transfer(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_transfer_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_transfer_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Transfer() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_transfer() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_transfer_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Transfer", + 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; +} + +/** + * org_ofono_voice_call_manager_call_swap_calls: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 SwapCalls() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_swap_calls_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_swap_calls_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_swap_calls ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SwapCalls", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_swap_calls_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_swap_calls(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_swap_calls(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_swap_calls_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_swap_calls_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the SwapCalls() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_swap_calls() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_swap_calls_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SwapCalls", + 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; +} + +/** + * org_ofono_voice_call_manager_call_release_and_answer: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 ReleaseAndAnswer() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_release_and_answer_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_release_and_answer_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_release_and_answer ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ReleaseAndAnswer", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_release_and_answer_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_release_and_answer(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_release_and_answer(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_release_and_answer_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_release_and_answer_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the ReleaseAndAnswer() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_release_and_answer() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_release_and_answer_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ReleaseAndAnswer", + 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; +} + +/** + * org_ofono_voice_call_manager_call_hold_and_answer: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 HoldAndAnswer() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_hold_and_answer_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_hold_and_answer_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_hold_and_answer ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "HoldAndAnswer", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_hold_and_answer_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_hold_and_answer(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_hold_and_answer(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_hold_and_answer_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_hold_and_answer_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the HoldAndAnswer() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_hold_and_answer() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_hold_and_answer_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "HoldAndAnswer", + 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; +} + +/** + * org_ofono_voice_call_manager_call_hangup_all: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 HangupAll() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_hangup_all_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_hangup_all_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_hangup_all ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "HangupAll", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_hangup_all_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_hangup_all(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_hangup_all(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_hangup_all_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_hangup_all_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the HangupAll() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_hangup_all() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_hangup_all_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "HangupAll", + 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; +} + +/** + * org_ofono_voice_call_manager_call_private_chat: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @arg_unnamed_arg0: 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 PrivateChat() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_private_chat_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_private_chat_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_private_chat ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "PrivateChat", + g_variant_new ("(o)", + arg_unnamed_arg0), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_private_chat_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg1: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_private_chat(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_private_chat(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_private_chat_finish ( + OrgOfonoVoiceCallManager *proxy, + gchar ***out_unnamed_arg1, + 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, + "(^ao)", + out_unnamed_arg1); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_private_chat_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @out_unnamed_arg1: (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 PrivateChat() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_private_chat() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_private_chat_sync ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + gchar ***out_unnamed_arg1, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "PrivateChat", + g_variant_new ("(o)", + arg_unnamed_arg0), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_unnamed_arg1); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_create_multiparty: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 CreateMultiparty() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_create_multiparty_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_create_multiparty_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_create_multiparty ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CreateMultiparty", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_create_multiparty_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_create_multiparty(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_create_multiparty(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_create_multiparty_finish ( + OrgOfonoVoiceCallManager *proxy, + gchar ***out_unnamed_arg0, + 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, + "(^ao)", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_create_multiparty_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg0: (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 CreateMultiparty() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_create_multiparty() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_create_multiparty_sync ( + OrgOfonoVoiceCallManager *proxy, + gchar ***out_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CreateMultiparty", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(^ao)", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_hangup_multiparty: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 HangupMultiparty() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_hangup_multiparty_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_hangup_multiparty_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_hangup_multiparty ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "HangupMultiparty", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_hangup_multiparty_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_hangup_multiparty(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_hangup_multiparty(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_hangup_multiparty_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_hangup_multiparty_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the HangupMultiparty() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_hangup_multiparty() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_hangup_multiparty_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "HangupMultiparty", + 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; +} + +/** + * org_ofono_voice_call_manager_call_send_tones: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @arg_unnamed_arg0: 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 SendTones() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_send_tones_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_send_tones_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_send_tones ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "SendTones", + g_variant_new ("(s)", + arg_unnamed_arg0), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_send_tones_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_send_tones(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_send_tones(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_send_tones_finish ( + OrgOfonoVoiceCallManager *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; +} + +/** + * org_ofono_voice_call_manager_call_send_tones_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @arg_unnamed_arg0: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the SendTones() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_send_tones() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_send_tones_sync ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "SendTones", + g_variant_new ("(s)", + arg_unnamed_arg0), + 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; +} + +/** + * org_ofono_voice_call_manager_call_get_calls: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @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 GetCalls() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_call_get_calls_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_call_get_calls_sync() for the synchronous, blocking version of this method. + */ +void +org_ofono_voice_call_manager_call_get_calls ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "GetCalls", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * org_ofono_voice_call_manager_call_get_calls_finish: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg0: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_call_get_calls(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with org_ofono_voice_call_manager_call_get_calls(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_get_calls_finish ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + 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, + "(@a(oa{sv}))", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_call_get_calls_sync: + * @proxy: A #OrgOfonoVoiceCallManagerProxy. + * @out_unnamed_arg0: (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 GetCalls() D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_call_get_calls() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +org_ofono_voice_call_manager_call_get_calls_sync ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "GetCalls", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(@a(oa{sv}))", + out_unnamed_arg0); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * org_ofono_voice_call_manager_complete_get_properties: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg0: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetProperties() 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 +org_ofono_voice_call_manager_complete_get_properties ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@a{sv})", + unnamed_arg0)); +} + +/** + * org_ofono_voice_call_manager_complete_dial: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg2: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the Dial() 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 +org_ofono_voice_call_manager_complete_dial ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *unnamed_arg2) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(o)", + unnamed_arg2)); +} + +/** + * org_ofono_voice_call_manager_complete_transfer: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Transfer() 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 +org_ofono_voice_call_manager_complete_transfer ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_swap_calls: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the SwapCalls() 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 +org_ofono_voice_call_manager_complete_swap_calls ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_release_and_answer: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the ReleaseAndAnswer() 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 +org_ofono_voice_call_manager_complete_release_and_answer ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_hold_and_answer: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the HoldAndAnswer() 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 +org_ofono_voice_call_manager_complete_hold_and_answer ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_hangup_all: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the HangupAll() 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 +org_ofono_voice_call_manager_complete_hangup_all ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_private_chat: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg1: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the PrivateChat() 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 +org_ofono_voice_call_manager_complete_private_chat ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *unnamed_arg1) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + unnamed_arg1)); +} + +/** + * org_ofono_voice_call_manager_complete_create_multiparty: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg0: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the CreateMultiparty() 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 +org_ofono_voice_call_manager_complete_create_multiparty ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *unnamed_arg0) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ao)", + unnamed_arg0)); +} + +/** + * org_ofono_voice_call_manager_complete_hangup_multiparty: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the HangupMultiparty() 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 +org_ofono_voice_call_manager_complete_hangup_multiparty ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_send_tones: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the SendTones() 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 +org_ofono_voice_call_manager_complete_send_tones ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * org_ofono_voice_call_manager_complete_get_calls: + * @object: A #OrgOfonoVoiceCallManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @unnamed_arg0: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetCalls() 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 +org_ofono_voice_call_manager_complete_get_calls ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(@a(oa{sv}))", + unnamed_arg0)); +} + +/* ------------------------------------------------------------------------ */ + +/** + * OrgOfonoVoiceCallManagerProxy: + * + * The #OrgOfonoVoiceCallManagerProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * OrgOfonoVoiceCallManagerProxyClass: + * @parent_class: The parent class. + * + * Class structure for #OrgOfonoVoiceCallManagerProxy. + */ + +struct _OrgOfonoVoiceCallManagerProxyPrivate +{ + GData *qdata; +}; + +static void org_ofono_voice_call_manager_proxy_iface_init (OrgOfonoVoiceCallManagerIface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallManagerProxy, org_ofono_voice_call_manager_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (OrgOfonoVoiceCallManagerProxy) + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL_MANAGER, org_ofono_voice_call_manager_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallManagerProxy, org_ofono_voice_call_manager_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL_MANAGER, org_ofono_voice_call_manager_proxy_iface_init)); + +#endif +static void +org_ofono_voice_call_manager_proxy_finalize (GObject *object) +{ + OrgOfonoVoiceCallManagerProxy *proxy = ORG_OFONO_VOICE_CALL_MANAGER_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (org_ofono_voice_call_manager_proxy_parent_class)->finalize (object); +} + +static void +org_ofono_voice_call_manager_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ +} + +static void +org_ofono_voice_call_manager_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ +} + +static void +org_ofono_voice_call_manager_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 *) &_org_ofono_voice_call_manager_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_ORG_OFONO_VOICE_CALL_MANAGER); + 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_ORG_OFONO_VOICE_CALL_MANAGER); + 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 +org_ofono_voice_call_manager_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + OrgOfonoVoiceCallManagerProxy *proxy = ORG_OFONO_VOICE_CALL_MANAGER_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 *) &_org_ofono_voice_call_manager_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 *) &_org_ofono_voice_call_manager_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 void +org_ofono_voice_call_manager_proxy_init (OrgOfonoVoiceCallManagerProxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = org_ofono_voice_call_manager_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY, OrgOfonoVoiceCallManagerProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), org_ofono_voice_call_manager_interface_info ()); +} + +static void +org_ofono_voice_call_manager_proxy_class_init (OrgOfonoVoiceCallManagerProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = org_ofono_voice_call_manager_proxy_finalize; + gobject_class->get_property = org_ofono_voice_call_manager_proxy_get_property; + gobject_class->set_property = org_ofono_voice_call_manager_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = org_ofono_voice_call_manager_proxy_g_signal; + proxy_class->g_properties_changed = org_ofono_voice_call_manager_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (OrgOfonoVoiceCallManagerProxyPrivate)); +#endif +} + +static void +org_ofono_voice_call_manager_proxy_iface_init (OrgOfonoVoiceCallManagerIface *iface) +{ +} + +/** + * org_ofono_voice_call_manager_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 org.ofono.VoiceCallManager. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_proxy_new_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +org_ofono_voice_call_manager_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_ORG_OFONO_VOICE_CALL_MANAGER_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.ofono.VoiceCallManager", NULL); +} + +/** + * org_ofono_voice_call_manager_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with org_ofono_voice_call_manager_proxy_new(). + * + * Returns: (transfer full) (type OrgOfonoVoiceCallManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCallManager * +org_ofono_voice_call_manager_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 ORG_OFONO_VOICE_CALL_MANAGER (ret); + else + return NULL; +} + +/** + * org_ofono_voice_call_manager_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 org.ofono.VoiceCallManager. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type OrgOfonoVoiceCallManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCallManager * +org_ofono_voice_call_manager_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_ORG_OFONO_VOICE_CALL_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.ofono.VoiceCallManager", NULL); + if (ret != NULL) + return ORG_OFONO_VOICE_CALL_MANAGER (ret); + else + return NULL; +} + + +/** + * org_ofono_voice_call_manager_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 org_ofono_voice_call_manager_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method from. + * You can then call org_ofono_voice_call_manager_proxy_new_for_bus_finish() to get the result of the operation. + * + * See org_ofono_voice_call_manager_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +org_ofono_voice_call_manager_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_ORG_OFONO_VOICE_CALL_MANAGER_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.ofono.VoiceCallManager", NULL); +} + +/** + * org_ofono_voice_call_manager_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to org_ofono_voice_call_manager_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with org_ofono_voice_call_manager_proxy_new_for_bus(). + * + * Returns: (transfer full) (type OrgOfonoVoiceCallManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCallManager * +org_ofono_voice_call_manager_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 ORG_OFONO_VOICE_CALL_MANAGER (ret); + else + return NULL; +} + +/** + * org_ofono_voice_call_manager_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 org_ofono_voice_call_manager_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See org_ofono_voice_call_manager_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type OrgOfonoVoiceCallManagerProxy): The constructed proxy object or %NULL if @error is set. + */ +OrgOfonoVoiceCallManager * +org_ofono_voice_call_manager_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_ORG_OFONO_VOICE_CALL_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.ofono.VoiceCallManager", NULL); + if (ret != NULL) + return ORG_OFONO_VOICE_CALL_MANAGER (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * OrgOfonoVoiceCallManagerSkeleton: + * + * The #OrgOfonoVoiceCallManagerSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * OrgOfonoVoiceCallManagerSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #OrgOfonoVoiceCallManagerSkeleton. + */ + +struct _OrgOfonoVoiceCallManagerSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_org_ofono_voice_call_manager_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) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_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_ORG_OFONO_VOICE_CALL_MANAGER); + 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_ORG_OFONO_VOICE_CALL_MANAGER); + 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 * +_org_ofono_voice_call_manager_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) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_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 *) &_org_ofono_voice_call_manager_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 +_org_ofono_voice_call_manager_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) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_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 *) &_org_ofono_voice_call_manager_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 _org_ofono_voice_call_manager_skeleton_vtable = +{ + _org_ofono_voice_call_manager_skeleton_handle_method_call, + _org_ofono_voice_call_manager_skeleton_handle_get_property, + _org_ofono_voice_call_manager_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +org_ofono_voice_call_manager_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return org_ofono_voice_call_manager_interface_info (); +} + +static GDBusInterfaceVTable * +org_ofono_voice_call_manager_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_org_ofono_voice_call_manager_skeleton_vtable; +} + +static GVariant * +org_ofono_voice_call_manager_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_org_ofono_voice_call_manager_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _org_ofono_voice_call_manager_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _org_ofono_voice_call_manager_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _org_ofono_voice_call_manager_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.ofono.VoiceCallManager", 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 void +org_ofono_voice_call_manager_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ +} + +static void +_org_ofono_voice_call_manager_on_signal_property_changed ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s@v)", + arg_unnamed_arg0, + arg_unnamed_arg1)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCallManager", "PropertyChanged", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_org_ofono_voice_call_manager_on_signal_call_added ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o@a{sv})", + arg_unnamed_arg0, + arg_unnamed_arg1)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCallManager", "CallAdded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_org_ofono_voice_call_manager_on_signal_call_removed ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(o)", + arg_unnamed_arg0)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCallManager", "CallRemoved", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_org_ofono_voice_call_manager_on_signal_barring_active ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s)", + arg_unnamed_arg0)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCallManager", "BarringActive", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void +_org_ofono_voice_call_manager_on_signal_forwarded ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(s)", + arg_unnamed_arg0)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.ofono.VoiceCallManager", "Forwarded", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void org_ofono_voice_call_manager_skeleton_iface_init (OrgOfonoVoiceCallManagerIface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallManagerSkeleton, org_ofono_voice_call_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (OrgOfonoVoiceCallManagerSkeleton) + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL_MANAGER, org_ofono_voice_call_manager_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (OrgOfonoVoiceCallManagerSkeleton, org_ofono_voice_call_manager_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_ORG_OFONO_VOICE_CALL_MANAGER, org_ofono_voice_call_manager_skeleton_iface_init)); + +#endif +static void +org_ofono_voice_call_manager_skeleton_finalize (GObject *object) +{ + OrgOfonoVoiceCallManagerSkeleton *skeleton = ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (object); + 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 (org_ofono_voice_call_manager_skeleton_parent_class)->finalize (object); +} + +static void +org_ofono_voice_call_manager_skeleton_init (OrgOfonoVoiceCallManagerSkeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = org_ofono_voice_call_manager_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON, OrgOfonoVoiceCallManagerSkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); +} + +static void +org_ofono_voice_call_manager_skeleton_class_init (OrgOfonoVoiceCallManagerSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = org_ofono_voice_call_manager_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = org_ofono_voice_call_manager_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = org_ofono_voice_call_manager_skeleton_dbus_interface_get_properties; + skeleton_class->flush = org_ofono_voice_call_manager_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = org_ofono_voice_call_manager_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (OrgOfonoVoiceCallManagerSkeletonPrivate)); +#endif +} + +static void +org_ofono_voice_call_manager_skeleton_iface_init (OrgOfonoVoiceCallManagerIface *iface) +{ + iface->property_changed = _org_ofono_voice_call_manager_on_signal_property_changed; + iface->call_added = _org_ofono_voice_call_manager_on_signal_call_added; + iface->call_removed = _org_ofono_voice_call_manager_on_signal_call_removed; + iface->barring_active = _org_ofono_voice_call_manager_on_signal_barring_active; + iface->forwarded = _org_ofono_voice_call_manager_on_signal_forwarded; +} + +/** + * org_ofono_voice_call_manager_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.ofono.VoiceCallManager. + * + * Returns: (transfer full) (type OrgOfonoVoiceCallManagerSkeleton): The skeleton object. + */ +OrgOfonoVoiceCallManager * +org_ofono_voice_call_manager_skeleton_new (void) +{ + return ORG_OFONO_VOICE_CALL_MANAGER (g_object_new (TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON, NULL)); +} + diff --git a/binding/gdbus/ofono_voicecallmanager_interface.h b/binding/gdbus/ofono_voicecallmanager_interface.h new file mode 100644 index 0000000..3daa0e0 --- /dev/null +++ b/binding/gdbus/ofono_voicecallmanager_interface.h @@ -0,0 +1,514 @@ +/* + * Generated by gdbus-codegen 2.50.3. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __OFONO_VOICECALLMANAGER_INTERFACE_H__ +#define __OFONO_VOICECALLMANAGER_INTERFACE_H__ + +#include + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.ofono.VoiceCallManager */ + +#define TYPE_ORG_OFONO_VOICE_CALL_MANAGER (org_ofono_voice_call_manager_get_type ()) +#define ORG_OFONO_VOICE_CALL_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER, OrgOfonoVoiceCallManager)) +#define IS_ORG_OFONO_VOICE_CALL_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER)) +#define ORG_OFONO_VOICE_CALL_MANAGER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER, OrgOfonoVoiceCallManagerIface)) + +struct _OrgOfonoVoiceCallManager; +typedef struct _OrgOfonoVoiceCallManager OrgOfonoVoiceCallManager; +typedef struct _OrgOfonoVoiceCallManagerIface OrgOfonoVoiceCallManagerIface; + +struct _OrgOfonoVoiceCallManagerIface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_create_multiparty) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_dial) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *arg_unnamed_arg0, + const gchar *arg_unnamed_arg1); + + gboolean (*handle_get_calls) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_get_properties) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_hangup_all) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_hangup_multiparty) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_hold_and_answer) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_private_chat) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *arg_unnamed_arg0); + + gboolean (*handle_release_and_answer) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_send_tones) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *arg_unnamed_arg0); + + gboolean (*handle_swap_calls) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_transfer) ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + + void (*barring_active) ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0); + + void (*call_added) ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + + void (*call_removed) ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0); + + void (*forwarded) ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0); + + void (*property_changed) ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + +}; + +GType org_ofono_voice_call_manager_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *org_ofono_voice_call_manager_interface_info (void); +guint org_ofono_voice_call_manager_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void org_ofono_voice_call_manager_complete_get_properties ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0); + +void org_ofono_voice_call_manager_complete_dial ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *unnamed_arg2); + +void org_ofono_voice_call_manager_complete_transfer ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_swap_calls ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_release_and_answer ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_hold_and_answer ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_hangup_all ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_private_chat ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *unnamed_arg1); + +void org_ofono_voice_call_manager_complete_create_multiparty ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + const gchar *const *unnamed_arg0); + +void org_ofono_voice_call_manager_complete_hangup_multiparty ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_send_tones ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation); + +void org_ofono_voice_call_manager_complete_get_calls ( + OrgOfonoVoiceCallManager *object, + GDBusMethodInvocation *invocation, + GVariant *unnamed_arg0); + + + +/* D-Bus signal emissions functions: */ +void org_ofono_voice_call_manager_emit_property_changed ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + +void org_ofono_voice_call_manager_emit_call_added ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0, + GVariant *arg_unnamed_arg1); + +void org_ofono_voice_call_manager_emit_call_removed ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0); + +void org_ofono_voice_call_manager_emit_barring_active ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0); + +void org_ofono_voice_call_manager_emit_forwarded ( + OrgOfonoVoiceCallManager *object, + const gchar *arg_unnamed_arg0); + + + +/* D-Bus method calls: */ +void org_ofono_voice_call_manager_call_get_properties ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_get_properties_finish ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_get_properties_sync ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_dial ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + const gchar *arg_unnamed_arg1, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_dial_finish ( + OrgOfonoVoiceCallManager *proxy, + gchar **out_unnamed_arg2, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_dial_sync ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + const gchar *arg_unnamed_arg1, + gchar **out_unnamed_arg2, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_transfer ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_transfer_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_transfer_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_swap_calls ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_swap_calls_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_swap_calls_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_release_and_answer ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_release_and_answer_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_release_and_answer_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_hold_and_answer ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_hold_and_answer_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_hold_and_answer_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_hangup_all ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_hangup_all_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_hangup_all_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_private_chat ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_private_chat_finish ( + OrgOfonoVoiceCallManager *proxy, + gchar ***out_unnamed_arg1, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_private_chat_sync ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + gchar ***out_unnamed_arg1, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_create_multiparty ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_create_multiparty_finish ( + OrgOfonoVoiceCallManager *proxy, + gchar ***out_unnamed_arg0, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_create_multiparty_sync ( + OrgOfonoVoiceCallManager *proxy, + gchar ***out_unnamed_arg0, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_hangup_multiparty ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_hangup_multiparty_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_hangup_multiparty_sync ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_send_tones ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_send_tones_finish ( + OrgOfonoVoiceCallManager *proxy, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_send_tones_sync ( + OrgOfonoVoiceCallManager *proxy, + const gchar *arg_unnamed_arg0, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_call_get_calls ( + OrgOfonoVoiceCallManager *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean org_ofono_voice_call_manager_call_get_calls_finish ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + GAsyncResult *res, + GError **error); + +gboolean org_ofono_voice_call_manager_call_get_calls_sync ( + OrgOfonoVoiceCallManager *proxy, + GVariant **out_unnamed_arg0, + GCancellable *cancellable, + GError **error); + + + +/* ---- */ + +#define TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY (org_ofono_voice_call_manager_proxy_get_type ()) +#define ORG_OFONO_VOICE_CALL_MANAGER_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY, OrgOfonoVoiceCallManagerProxy)) +#define ORG_OFONO_VOICE_CALL_MANAGER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY, OrgOfonoVoiceCallManagerProxyClass)) +#define ORG_OFONO_VOICE_CALL_MANAGER_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY, OrgOfonoVoiceCallManagerProxyClass)) +#define IS_ORG_OFONO_VOICE_CALL_MANAGER_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY)) +#define IS_ORG_OFONO_VOICE_CALL_MANAGER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_PROXY)) + +typedef struct _OrgOfonoVoiceCallManagerProxy OrgOfonoVoiceCallManagerProxy; +typedef struct _OrgOfonoVoiceCallManagerProxyClass OrgOfonoVoiceCallManagerProxyClass; +typedef struct _OrgOfonoVoiceCallManagerProxyPrivate OrgOfonoVoiceCallManagerProxyPrivate; + +struct _OrgOfonoVoiceCallManagerProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + OrgOfonoVoiceCallManagerProxyPrivate *priv; +}; + +struct _OrgOfonoVoiceCallManagerProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType org_ofono_voice_call_manager_proxy_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OrgOfonoVoiceCallManagerProxy, g_object_unref) +#endif + +void org_ofono_voice_call_manager_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +OrgOfonoVoiceCallManager *org_ofono_voice_call_manager_proxy_new_finish ( + GAsyncResult *res, + GError **error); +OrgOfonoVoiceCallManager *org_ofono_voice_call_manager_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void org_ofono_voice_call_manager_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +OrgOfonoVoiceCallManager *org_ofono_voice_call_manager_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +OrgOfonoVoiceCallManager *org_ofono_voice_call_manager_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON (org_ofono_voice_call_manager_skeleton_get_type ()) +#define ORG_OFONO_VOICE_CALL_MANAGER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON, OrgOfonoVoiceCallManagerSkeleton)) +#define ORG_OFONO_VOICE_CALL_MANAGER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON, OrgOfonoVoiceCallManagerSkeletonClass)) +#define ORG_OFONO_VOICE_CALL_MANAGER_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON, OrgOfonoVoiceCallManagerSkeletonClass)) +#define IS_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON)) +#define IS_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ORG_OFONO_VOICE_CALL_MANAGER_SKELETON)) + +typedef struct _OrgOfonoVoiceCallManagerSkeleton OrgOfonoVoiceCallManagerSkeleton; +typedef struct _OrgOfonoVoiceCallManagerSkeletonClass OrgOfonoVoiceCallManagerSkeletonClass; +typedef struct _OrgOfonoVoiceCallManagerSkeletonPrivate OrgOfonoVoiceCallManagerSkeletonPrivate; + +struct _OrgOfonoVoiceCallManagerSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + OrgOfonoVoiceCallManagerSkeletonPrivate *priv; +}; + +struct _OrgOfonoVoiceCallManagerSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType org_ofono_voice_call_manager_skeleton_get_type (void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (OrgOfonoVoiceCallManagerSkeleton, g_object_unref) +#endif + +OrgOfonoVoiceCallManager *org_ofono_voice_call_manager_skeleton_new (void); + + +G_END_DECLS + +#endif /* __OFONO_VOICECALLMANAGER_INTERFACE_H__ */ diff --git a/binding/telephony-binding.c b/binding/telephony-binding.c new file mode 100644 index 0000000..f6db061 --- /dev/null +++ b/binding/telephony-binding.c @@ -0,0 +1,370 @@ +/* + * Copyright (C) 2017-2018 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE + +#include +#include +#include + +#define AFB_BINDING_VERSION 2 +#include + +#include "ofono_manager.h" +#include "ofono_voicecallmanager.h" +#include "ofono_voicecall.h" + +static OrgOfonoVoiceCallManager *vcm; +static OrgOfonoVoiceCall *incoming_call, *voice_call; +static struct afb_event call_state_changed_event; +static struct afb_event dialing_call_event; +static struct afb_event incoming_call_event; +static struct afb_event terminated_call_event; + +static void dial(struct afb_req request) +{ + struct json_object *query, *val; + const char *number; + + query = afb_req_json(request); + json_object_object_get_ex(query, "value", &val); + if (json_object_is_type(val, json_type_string)) { + number = json_object_get_string(val); + if (voice_call) { + AFB_ERROR("dial: cannot dial with active call"); + afb_req_fail(request, "active call", NULL); + } else { + AFB_DEBUG("dial: %s...\n", number); + if (ofono_voicecallmanager_dial(vcm, (gchar *)number, "")) { + afb_req_success(request, NULL, NULL); + } else { + AFB_ERROR("dial: failed to dial number\n"); + afb_req_fail(request, "failed dial", NULL); + } + } + } else { + AFB_ERROR("dial: no phone number parameter\n"); + afb_req_fail(request, "no number", NULL); + } +} + +static void hangup(struct afb_req request) +{ + if (voice_call) { + AFB_DEBUG("Hangup voice call\n"); + ofono_voicecall_hangup(voice_call); + afb_req_success(request, NULL, NULL); + } else if (incoming_call) { + AFB_DEBUG("Reject incoming call\n"); + ofono_voicecall_hangup(incoming_call); + afb_req_success(request, NULL, NULL); + } else { + AFB_ERROR("Hangup: no active call"); + afb_req_fail(request, "failed hangup", NULL); + } +} + +static void answer(struct afb_req request) +{ + if (incoming_call) { + AFB_DEBUG("Answer voice call\n"); + voice_call = incoming_call; + ofono_voicecall_answer(voice_call); + } else { + AFB_ERROR("Answer: no incoming call"); + } +} + +static void subscribe(struct afb_req request) +{ + const char *value = afb_req_value(request, "value"); + if(value) { + if (!strcasecmp(value, "callStateChanged")) { + afb_req_subscribe(request, call_state_changed_event); + } else if (!strcasecmp(value, "dialingCall")) { + afb_req_subscribe(request, dialing_call_event); + } else if (!strcasecmp(value, "incomingCall")) { + afb_req_subscribe(request, incoming_call_event); + } else if (!strcasecmp(value, "terminatedCall")) { + afb_req_subscribe(request, terminated_call_event); + } else { + afb_req_fail(request, "failed", "Invalid event"); + return; + } + } + + afb_req_success(request, NULL, NULL); +} + +static void unsubscribe(struct afb_req request) +{ + const char *value = afb_req_value(request, "value"); + if(value) { + if (!strcasecmp(value, "callStateChanged")) { + afb_req_unsubscribe(request, call_state_changed_event); + } else if (!strcasecmp(value, "dialingCall")) { + afb_req_unsubscribe(request, dialing_call_event); + } else if (!strcasecmp(value, "incomingCall")) { + afb_req_unsubscribe(request, incoming_call_event); + } else if (!strcasecmp(value, "terminatedCall")) { + afb_req_unsubscribe(request, terminated_call_event); + } else { + afb_req_fail(request, "failed", "Invalid event"); + return; + } + } + + afb_req_success(request, NULL, NULL); +} + +static void call_state_changed_cb(OrgOfonoVoiceCall *vc, gchar *state) +{ + struct json_object *call_state; + call_state = json_object_new_object(); + json_object_object_add(call_state, "state", json_object_new_string(state)); + afb_event_push(call_state_changed_event, call_state); +} + +static void incoming_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op, gchar *clip) +{ + struct json_object *call_info; + + call_info = json_object_new_object(); + json_object_object_add(call_info, "clip", json_object_new_string(clip)); + afb_event_push(incoming_call_event, call_info); + incoming_call = ofono_voicecall_new(op, call_state_changed_cb); +} + +static void dialing_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op, gchar *colp) +{ + struct json_object *call_info; + + call_info = json_object_new_object(); + json_object_object_add(call_info, "colp", json_object_new_string(colp)); + afb_event_push(dialing_call_event, call_info); + voice_call = ofono_voicecall_new(op, call_state_changed_cb); +} + +static void terminated_call_cb(OrgOfonoVoiceCallManager *manager, gchar *op) +{ + if (incoming_call) { + ofono_voicecall_free(incoming_call); + incoming_call = NULL; + } else if (voice_call) { + ofono_voicecall_free(voice_call); + } + voice_call = NULL; + afb_event_push(terminated_call_event, NULL); +} + +static void *main_loop_thread(void *unused) +{ + GMainLoop *loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(loop); + return NULL; +} + +static int ofono_init_default_modem(void) +{ + int ret = 0; + const gchar *modem_path = ofono_manager_get_default_modem_path(); + + if (modem_path) { + vcm = ofono_voicecallmanager_init(modem_path, + incoming_call_cb, + dialing_call_cb, + terminated_call_cb); + if (!vcm) { + AFB_ERROR("failed to initialize voice call manager\n"); + ret = -1; + } + } else { + AFB_ERROR("default modem not set\n"); + ret = -1; + } + + return ret; +} + +static gboolean is_hfp_dev_and_init(struct json_object *dev) +{ + int ret; + gboolean hfp = FALSE; + struct json_object *name, *address, *hfp_connected; + json_object_object_get_ex(dev, "Name", &name); + json_object_object_get_ex(dev, "Address", &address); + json_object_object_get_ex(dev, "HFPConnected", &hfp_connected); + if (!strcmp(json_object_get_string(hfp_connected), "True")) { + ret = ofono_manager_set_default_modem(json_object_get_string(address)); + if (ret == 0) { + ofono_init_default_modem(); + hfp = TRUE; + } + } + + return hfp; +} + +static void discovery_result_cb(void *closure, int status, struct json_object *result) +{ + enum json_type type; + struct json_object *devs, *dev; + int i; + + json_object_object_foreach(result, key, val) { + type = json_object_get_type(val); + switch (type) { + case json_type_array: + json_object_object_get_ex(result, key, &devs); + for (i = 0; i < json_object_array_length(devs); i++) { + dev = json_object_array_get_idx(devs, i); + if (is_hfp_dev_and_init(dev)) + break; + } + break; + case json_type_string: + case json_type_boolean: + case json_type_double: + case json_type_int: + case json_type_object: + case json_type_null: + default: + break; + } + } +} + +static void ofono_hfp_init(void) +{ + struct json_object *args, *response; + + args = json_object_new_object(); + json_object_object_add(args , "value", json_object_new_string("connection")); + afb_service_call_sync("Bluetooth-Manager", "subscribe", args, &response); + + args = json_object_new_object(); + afb_service_call("Bluetooth-Manager", "discovery_result", args, discovery_result_cb, &response); +} + +static int ofono_init(void) +{ + pthread_t tid; + int ret = 0; + + call_state_changed_event = afb_daemon_make_event("callStateChanged"); + dialing_call_event = afb_daemon_make_event("dialingCall"); + incoming_call_event = afb_daemon_make_event("incomingCall"); + terminated_call_event = afb_daemon_make_event("terminatedCall"); + + ret = afb_daemon_require_api("Bluetooth-Manager", 1); + if (ret) { + AFB_ERROR("unable to initialize bluetooth binding"); + return -1; + } + + /* Start the main loop thread */ + pthread_create(&tid, NULL, main_loop_thread, NULL); + + ret = ofono_manager_init(); + if (ret == 0) { + ofono_manager_invalidate_default_modem(); + ofono_hfp_init(); + } else { + AFB_ERROR("failed to initialize ofono manager"); + } + + return ret; +} + +static const struct afb_verb_v2 verbs[]= { + { + .verb = "dial", + .callback = dial, + .auth = NULL, + .session = AFB_SESSION_NONE, + }, + { + .verb = "hangup", + .callback = hangup, + .auth = NULL, + .session = AFB_SESSION_NONE, + }, + { + .verb = "answer", + .callback = answer, + .auth = NULL, + .session = AFB_SESSION_NONE, + }, + { + .verb = "subscribe", + .callback = subscribe, + .auth = NULL, + .session = AFB_SESSION_NONE, + }, + { + .verb = "unsubscribe", + .callback = unsubscribe, + .auth = NULL, + .session = AFB_SESSION_NONE, + }, + {NULL} +}; + +static int init() +{ + AFB_NOTICE("Initializing telephony service"); + + return ofono_init(); +} + +static void process_connection_event(struct json_object *object) +{ + struct json_object *args, *response, *status_obj, *address_obj; + const char *status, *address; + + json_object_object_get_ex(object, "Status", &status_obj); + status = json_object_get_string(status_obj); + + if (!g_strcmp0(status, "connected")) { + args = json_object_new_object(); + afb_service_call("Bluetooth-Manager", "discovery_result", + args, discovery_result_cb, &response); + } else if (!g_strcmp0(status, "disconnected")) { + json_object_object_get_ex(object, "Address", &address_obj); + address = json_object_get_string(address_obj); + if (!g_strcmp0(address, ofono_manager_get_default_modem_address())) { + ofono_manager_invalidate_default_modem(); + ofono_voicecallmanager_free(vcm); + } + } else + AFB_ERROR("Unsupported connection status: %s\n", status); +} + +static void onevent(const char *event, struct json_object *object) +{ + if (!g_strcmp0(event, "Bluetooth-Manager/connection")) + process_connection_event(object); + else + AFB_ERROR("Unsupported event: %s\n", event); +} + +const struct afb_binding_v2 afbBindingV2 = { + .api = "telephony", + .specification = NULL, + .verbs = verbs, + .init = init, + .onevent = onevent, +}; -- cgit 1.2.3-korg