|
Packit |
d14447 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
Packit |
d14447 |
/*
|
|
Packit |
d14447 |
* libmm -- Access modem status & information from glib applications
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
d14447 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
d14447 |
* License as published by the Free Software Foundation; either
|
|
Packit |
d14447 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
d14447 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
d14447 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
d14447 |
* Lesser General Public License for more details.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
d14447 |
* License along with this library; if not, write to the
|
|
Packit |
d14447 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Packit |
d14447 |
* Boston, MA 02110-1301 USA.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Copyright (C) 2011 - 2012 Aleksander Morgado <aleksander@gnu.org>
|
|
Packit |
d14447 |
* Copyright (C) 2012 Google, Inc.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
#include <gio/gio.h>
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
#include "mm-helpers.h"
|
|
Packit |
d14447 |
#include "mm-errors-types.h"
|
|
Packit |
d14447 |
#include "mm-modem-3gpp-ussd.h"
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* SECTION: mm-modem-3gpp-ussd
|
|
Packit |
d14447 |
* @title: MMModem3gppUssd
|
|
Packit |
d14447 |
* @short_description: The 3GPP USSD interface
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* The #MMModem3gppUssd is an object providing access to the methods, signals and
|
|
Packit |
d14447 |
* properties of the 3GPP USSD interface.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* This interface is only exposed when the 3GPP modem is known to handle USSD operations.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
G_DEFINE_TYPE (MMModem3gppUssd, mm_modem_3gpp_ussd, MM_GDBUS_TYPE_MODEM3GPP_USSD_PROXY)
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_get_path:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Gets the DBus path of the #MMObject which implements this interface.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: (transfer none): The DBus path of the #MMObject object.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
const gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_get_path (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
RETURN_NON_EMPTY_CONSTANT_STRING (
|
|
Packit |
d14447 |
g_dbus_proxy_get_object_path (G_DBUS_PROXY (self)));
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_dup_path:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Gets a copy of the DBus path of the #MMObject object which implements this interface.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: (transfer full): The DBus path of the #MMObject. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_dup_path (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
gchar *value;
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
g_object_get (G_OBJECT (self),
|
|
Packit |
d14447 |
"g-object-path", &value,
|
|
Packit |
d14447 |
NULL);
|
|
Packit |
d14447 |
RETURN_NON_EMPTY_STRING (value);
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_get_network_request:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Gets any pending network-initiated request.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* <warning>The returned value is only valid until the property changes so
|
|
Packit |
d14447 |
* it is only safe to use this function on the thread where
|
|
Packit |
d14447 |
* @self was constructed. Use mm_modem_3gpp_ussd_dup_network_request() if on another
|
|
Packit |
d14447 |
* thread.</warning>
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: (transfer none): The network request, or %NULL if none available.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
const gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_get_network_request (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
RETURN_NON_EMPTY_CONSTANT_STRING (
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_get_network_request (MM_GDBUS_MODEM3GPP_USSD (self)));
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_dup_network_request:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Gets a copy of any pending network-initiated request.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: (transfer full): The network request, or %NULL if none available. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_dup_network_request (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
RETURN_NON_EMPTY_STRING (
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_dup_network_request (MM_GDBUS_MODEM3GPP_USSD (self)));
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_get_network_notification:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Gets any pending network-initiated request to which no USSD response is required.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* <warning>The returned value is only valid until the property changes so
|
|
Packit |
d14447 |
* it is only safe to use this function on the thread where
|
|
Packit |
d14447 |
* @self was constructed. Use mm_modem_3gpp_ussd_dup_network_notification() if on another
|
|
Packit |
d14447 |
* thread.</warning>
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: (transfer none): The network notification, or %NULL if none available.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
const gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_get_network_notification (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
RETURN_NON_EMPTY_CONSTANT_STRING (
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_get_network_notification (MM_GDBUS_MODEM3GPP_USSD (self)));
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_dup_network_notification:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Gets a copy of any pending network-initiated request to which no USSD response is required.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: (transfer full): The network notification, or %NULL if none available. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_dup_network_notification (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
RETURN_NON_EMPTY_STRING (
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_dup_network_notification (MM_GDBUS_MODEM3GPP_USSD (self)));
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_get_state:
|
|
Packit |
d14447 |
* @self: A #MMModem.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Get the state of the ongoing USSD session, if any.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: A #MMModem3gppUssdSessionState value, specifying the current state.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
MMModem3gppUssdSessionState
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_get_state (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), MM_MODEM_3GPP_USSD_SESSION_STATE_UNKNOWN);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return mm_gdbus_modem3gpp_ussd_get_state (MM_GDBUS_MODEM3GPP_USSD (self));
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_initiate_finish:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_3gpp_ussd_initiate().
|
|
Packit |
d14447 |
* @error: Return location for error or %NULL.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Finishes an operation started with mm_modem_3gpp_ussd_initiate().
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: The response from the network, if any. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_initiate_finish (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
GAsyncResult *res,
|
|
Packit |
d14447 |
GError **error)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
gchar *reply = NULL;
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_initiate_finish (MM_GDBUS_MODEM3GPP_USSD (self), &reply, res, error);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return reply;
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_initiate:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @command: The command to start the USSD session with.
|
|
Packit |
d14447 |
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
|
Packit |
d14447 |
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
|
Packit |
d14447 |
* @user_data: User data to pass to @callback.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Asynchronously sends a USSD command string to the network initiating a USSD session.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* When the request is handled by the network, the method returns the
|
|
Packit |
d14447 |
* response or an appropriate error. The network may be awaiting further
|
|
Packit |
d14447 |
* response from the ME after returning from this method and no new command.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
|
|
Packit |
d14447 |
* You can then call mm_modem_3gpp_ussd_initiate_finish() to get the result of the operation.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* See mm_modem_3gpp_ussd_initiate_sync() for the synchronous, blocking version of this method.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
void
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_initiate (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
const gchar *command,
|
|
Packit |
d14447 |
GCancellable *cancellable,
|
|
Packit |
d14447 |
GAsyncReadyCallback callback,
|
|
Packit |
d14447 |
gpointer user_data)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_if_fail (MM_IS_MODEM_3GPP_USSD (self));
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_initiate (MM_GDBUS_MODEM3GPP_USSD (self), command, cancellable, callback, user_data);
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_initiate_sync:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @command: The command to start the USSD session with.
|
|
Packit |
d14447 |
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
|
Packit |
d14447 |
* @error: Return location for error or %NULL.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Synchronously sends a USSD command string to the network initiating a USSD session.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* When the request is handled by the network, the method returns the
|
|
Packit |
d14447 |
* response or an appropriate error. The network may be awaiting further
|
|
Packit |
d14447 |
* response from the ME after returning from this method and no new command.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* The calling thread is blocked until a reply is received. See mm_modem_3gpp_ussd_initiate()
|
|
Packit |
d14447 |
* for the asynchronous version of this method.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: The response from the network, if any. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_initiate_sync (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
const gchar *command,
|
|
Packit |
d14447 |
GCancellable *cancellable,
|
|
Packit |
d14447 |
GError **error)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
gchar *reply = NULL;
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_initiate_sync (MM_GDBUS_MODEM3GPP_USSD (self), command, &reply, cancellable, error);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return reply;
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_respond_finish:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_3gpp_ussd_respond().
|
|
Packit |
d14447 |
* @error: Return location for error or %NULL.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Finishes an operation started with mm_modem_3gpp_ussd_respond().
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: The network reply to this response to the network-initiated USSD command. The reply may require further responses. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_respond_finish (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
GAsyncResult *res,
|
|
Packit |
d14447 |
GError **error)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
gchar *reply = NULL;
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_respond_finish (MM_GDBUS_MODEM3GPP_USSD (self), &reply, res, error);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return reply;
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_respond:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @response: The response to network-initiated USSD command, or a response to a request for further input.
|
|
Packit |
d14447 |
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
|
Packit |
d14447 |
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
|
Packit |
d14447 |
* @user_data: User data to pass to @callback.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Asynchronously responds to a USSD request that is either initiated by the
|
|
Packit |
d14447 |
* mobile network, or that is awaiting further input after a previous call to
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_initiate().
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
|
|
Packit |
d14447 |
* You can then call mm_modem_3gpp_ussd_respond_finish() to get the result of the operation.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* See mm_modem_3gpp_ussd_respond_sync() for the synchronous, blocking version of this method.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
void
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_respond (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
const gchar *response,
|
|
Packit |
d14447 |
GCancellable *cancellable,
|
|
Packit |
d14447 |
GAsyncReadyCallback callback,
|
|
Packit |
d14447 |
gpointer user_data)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_if_fail (MM_IS_MODEM_3GPP_USSD (self));
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_respond (MM_GDBUS_MODEM3GPP_USSD (self), response, cancellable, callback, user_data);
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_respond_sync:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @response: The response to network-initiated USSD command, or a response to a request for further input.
|
|
Packit |
d14447 |
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
|
Packit |
d14447 |
* @error: Return location for error or %NULL.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Synchronously responds to a USSD request that is either initiated by the
|
|
Packit |
d14447 |
* mobile network, or that is awaiting further input after a previous call to
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_initiate().
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* The calling thread is blocked until a reply is received. See mm_modem_3gpp_ussd_respond()
|
|
Packit |
d14447 |
* for the asynchronous version of this method.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: The network reply to this response to the network-initiated USSD command. The reply may require further responses. The returned value should be freed with g_free().
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gchar *
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_respond_sync (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
const gchar *response,
|
|
Packit |
d14447 |
GCancellable *cancellable,
|
|
Packit |
d14447 |
GError **error)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
gchar *reply = NULL;
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), NULL);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_respond_sync (MM_GDBUS_MODEM3GPP_USSD (self), response, &reply, cancellable, error);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return reply;
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_cancel_finish:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_3gpp_ussd_cancel().
|
|
Packit |
d14447 |
* @error: Return location for error or %NULL.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Finishes an operation started with mm_modem_3gpp_ussd_cancel().
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: %TRUE if the session was successfully cancelled, %FALSE if @error is set.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gboolean
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_cancel_finish (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
GAsyncResult *res,
|
|
Packit |
d14447 |
GError **error)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), FALSE);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return mm_gdbus_modem3gpp_ussd_call_cancel_finish (MM_GDBUS_MODEM3GPP_USSD (self), res, error);
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_cancel:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
|
Packit |
d14447 |
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
|
Packit |
d14447 |
* @user_data: User data to pass to @callback.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Asynchronously cancels an ongoing USSD session, either mobile or network initiated.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
|
|
Packit |
d14447 |
* You can then call mm_modem_3gpp_ussd_cancel_finish() to get the result of the operation.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* See mm_modem_3gpp_ussd_cancel_sync() for the synchronous, blocking version of this method.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
void
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_cancel (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
GCancellable *cancellable,
|
|
Packit |
d14447 |
GAsyncReadyCallback callback,
|
|
Packit |
d14447 |
gpointer user_data)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_if_fail (MM_IS_MODEM_3GPP_USSD (self));
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
mm_gdbus_modem3gpp_ussd_call_cancel (MM_GDBUS_MODEM3GPP_USSD (self), cancellable, callback, user_data);
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/**
|
|
Packit |
d14447 |
* mm_modem_3gpp_ussd_cancel_sync:
|
|
Packit |
d14447 |
* @self: A #MMModem3gppUssd.
|
|
Packit |
d14447 |
* @cancellable: (allow-none): A #GCancellable or %NULL.
|
|
Packit |
d14447 |
* @error: Return location for error or %NULL.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Synchronously cancels an ongoing USSD session, either mobile or network initiated.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* The calling thread is blocked until a reply is received. See mm_modem_3gpp_ussd_cancel()
|
|
Packit |
d14447 |
* for the asynchronous version of this method.
|
|
Packit |
d14447 |
*
|
|
Packit |
d14447 |
* Returns: %TRUE if the session was successfully cancelled, %FALSE if @error is set.
|
|
Packit |
d14447 |
*/
|
|
Packit |
d14447 |
gboolean
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_cancel_sync (MMModem3gppUssd *self,
|
|
Packit |
d14447 |
GCancellable *cancellable,
|
|
Packit |
d14447 |
GError **error)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
g_return_val_if_fail (MM_IS_MODEM_3GPP_USSD (self), FALSE);
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
return mm_gdbus_modem3gpp_ussd_call_cancel_sync (MM_GDBUS_MODEM3GPP_USSD (self), cancellable, error);
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
/*****************************************************************************/
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
static void
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_init (MMModem3gppUssd *self)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
}
|
|
Packit |
d14447 |
|
|
Packit |
d14447 |
static void
|
|
Packit |
d14447 |
mm_modem_3gpp_ussd_class_init (MMModem3gppUssdClass *modem_class)
|
|
Packit |
d14447 |
{
|
|
Packit |
d14447 |
}
|