simtech: port 3gpp_disable_unsolicited_events to GTask
This commit is contained in:
@@ -283,10 +283,10 @@ modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||
|
||||
static gboolean
|
||||
modem_3gpp_disable_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
GAsyncResult *res,
|
||||
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 const MMBaseModemAtCommand unsolicited_disable_sequence[] = {
|
||||
@@ -297,31 +297,29 @@ static const MMBaseModemAtCommand unsolicited_disable_sequence[] = {
|
||||
|
||||
static void
|
||||
parent_disable_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!iface_modem_3gpp_parent->disable_unsolicited_events_finish (self, res, &error))
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
||||
g_simple_async_result_complete (simple);
|
||||
g_object_unref (simple);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
own_disable_unsolicited_events_ready (MMBaseModem *self,
|
||||
own_disable_unsolicited_events_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
mm_base_modem_at_sequence_full_finish (self, res, NULL, &error);
|
||||
if (error) {
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
g_simple_async_result_complete (simple);
|
||||
g_object_unref (simple);
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -329,7 +327,7 @@ own_disable_unsolicited_events_ready (MMBaseModem *self,
|
||||
iface_modem_3gpp_parent->disable_unsolicited_events (
|
||||
MM_IFACE_MODEM_3GPP (self),
|
||||
(GAsyncReadyCallback)parent_disable_unsolicited_events_ready,
|
||||
simple);
|
||||
task);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -337,13 +335,6 @@ modem_3gpp_disable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
modem_3gpp_disable_unsolicited_events);
|
||||
|
||||
/* Our own disable first */
|
||||
mm_base_modem_at_sequence_full (
|
||||
MM_BASE_MODEM (self),
|
||||
@@ -353,7 +344,7 @@ modem_3gpp_disable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||
NULL, /* response_processor_context_free */
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)own_disable_unsolicited_events_ready,
|
||||
result);
|
||||
g_task_new (self, NULL, callback, user_data));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
Reference in New Issue
Block a user