altair-lte: port modem_3gpp_{setup,cleanup}_unsolicited_events to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
282ed056a6
commit
00aaa1864a
@@ -752,26 +752,24 @@ modem_3gpp_setup_cleanup_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parent_3gpp_setup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
parent_3gpp_setup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!iface_modem_3gpp_parent->setup_unsolicited_events_finish (self, res, &error))
|
if (!iface_modem_3gpp_parent->setup_unsolicited_events_finish (self, res, &error))
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_task_return_error (task, error);
|
||||||
else {
|
else {
|
||||||
/* Our own setup now */
|
/* Our own setup now */
|
||||||
set_3gpp_unsolicited_events_handlers (MM_BROADBAND_MODEM_ALTAIR_LTE (self), TRUE);
|
set_3gpp_unsolicited_events_handlers (MM_BROADBAND_MODEM_ALTAIR_LTE (self), TRUE);
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
}
|
}
|
||||||
|
g_object_unref (task);
|
||||||
g_simple_async_result_complete (simple);
|
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -779,33 +777,29 @@ modem_3gpp_setup_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
GTask *task;
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
modem_3gpp_setup_unsolicited_events);
|
|
||||||
|
|
||||||
/* Chain up parent's setup */
|
/* Chain up parent's setup */
|
||||||
iface_modem_3gpp_parent->setup_unsolicited_events (
|
iface_modem_3gpp_parent->setup_unsolicited_events (
|
||||||
self,
|
self,
|
||||||
(GAsyncReadyCallback)parent_3gpp_setup_unsolicited_events_ready,
|
(GAsyncReadyCallback)parent_3gpp_setup_unsolicited_events_ready,
|
||||||
result);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parent_3gpp_cleanup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
parent_3gpp_cleanup_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!iface_modem_3gpp_parent->cleanup_unsolicited_events_finish (self, res, &error))
|
if (!iface_modem_3gpp_parent->cleanup_unsolicited_events_finish (self, res, &error))
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_task_return_error (task, error);
|
||||||
else
|
else
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
g_simple_async_result_complete (simple);
|
g_object_unref (task);
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -813,12 +807,9 @@ modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
GTask *task;
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
modem_3gpp_cleanup_unsolicited_events);
|
|
||||||
|
|
||||||
/* Our own cleanup first */
|
/* Our own cleanup first */
|
||||||
set_3gpp_unsolicited_events_handlers (MM_BROADBAND_MODEM_ALTAIR_LTE (self), FALSE);
|
set_3gpp_unsolicited_events_handlers (MM_BROADBAND_MODEM_ALTAIR_LTE (self), FALSE);
|
||||||
@@ -827,7 +818,7 @@ modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
iface_modem_3gpp_parent->cleanup_unsolicited_events (
|
iface_modem_3gpp_parent->cleanup_unsolicited_events (
|
||||||
self,
|
self,
|
||||||
(GAsyncReadyCallback)parent_3gpp_cleanup_unsolicited_events_ready,
|
(GAsyncReadyCallback)parent_3gpp_cleanup_unsolicited_events_ready,
|
||||||
result);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user