broadband-modem: implement USSD cancellation

This commit is contained in:
Aleksander Morgado
2012-03-15 14:14:57 +01:00
parent 8acf9e4fbc
commit e808e04910
+53
View File
@@ -2813,6 +2813,57 @@ modem_3gpp_setup_ps_registration (MMIfaceModem3gpp *self,
ctx);
}
/*****************************************************************************/
/* Cancel USSD (3GPP/USSD interface) */
static gboolean
modem_3gpp_ussd_cancel_finish (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error)
{
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
static void
cancel_command_ready (MMBroadbandModem *self,
GAsyncResult *res,
GSimpleAsyncResult *simple)
{
GError *error = NULL;
mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (error)
g_simple_async_result_take_error (simple, error);
else
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
g_simple_async_result_complete (simple);
g_object_unref (simple);
mm_iface_modem_3gpp_ussd_update_state (MM_IFACE_MODEM_3GPP_USSD (self),
MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE);
}
static void
modem_3gpp_ussd_cancel (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *result;
result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
modem_3gpp_ussd_cancel);
mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CUSD=2",
3,
TRUE,
NULL, /* cancellable */
(GAsyncReadyCallback)cancel_command_ready,
result);
}
/*****************************************************************************/
/* Send command (3GPP/USSD interface) */
@@ -5590,6 +5641,8 @@ iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface)
iface->decode = modem_3gpp_ussd_decode;
iface->send = modem_3gpp_ussd_send;
iface->send_finish = modem_3gpp_ussd_send_finish;
iface->cancel = modem_3gpp_ussd_cancel;
iface->cancel_finish = modem_3gpp_ussd_cancel_finish;
}
static void