simtech: port 3gpp_enable_unsolicited_events to GTask
This commit is contained in:
@@ -202,27 +202,26 @@ modem_3gpp_cleanup_unsolicited_events (MMIfaceModem3gpp *self,
|
|||||||
/* Enabling unsolicited events (3GPP interface) */
|
/* Enabling unsolicited events (3GPP interface) */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
modem_3gpp_enable_unsolicited_events_finish (MMIfaceModem3gpp *self,
|
modem_3gpp_enable_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
|
||||||
own_enable_unsolicited_events_ready (MMBaseModem *self,
|
own_enable_unsolicited_events_ready (MMBaseModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
mm_base_modem_at_sequence_full_finish (self, res, NULL, &error);
|
mm_base_modem_at_sequence_full_finish (self, res, NULL, &error);
|
||||||
if (error)
|
if (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 const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
static const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
||||||
@@ -235,15 +234,14 @@ static const MMBaseModemAtCommand unsolicited_enable_sequence[] = {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
parent_enable_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
parent_enable_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GSimpleAsyncResult *simple)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!iface_modem_3gpp_parent->enable_unsolicited_events_finish (self, res, &error)) {
|
if (!iface_modem_3gpp_parent->enable_unsolicited_events_finish (self, res, &error)) {
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_task_return_error (task, error);
|
||||||
g_simple_async_result_complete (simple);
|
g_object_unref (task);
|
||||||
g_object_unref (simple);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,26 +254,19 @@ parent_enable_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
|||||||
NULL, /* response_processor_context_free */
|
NULL, /* response_processor_context_free */
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)own_enable_unsolicited_events_ready,
|
(GAsyncReadyCallback)own_enable_unsolicited_events_ready,
|
||||||
simple);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self,
|
modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
|
||||||
|
|
||||||
result = g_simple_async_result_new (G_OBJECT (self),
|
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
modem_3gpp_enable_unsolicited_events);
|
|
||||||
|
|
||||||
/* Chain up parent's enable */
|
/* Chain up parent's enable */
|
||||||
iface_modem_3gpp_parent->enable_unsolicited_events (
|
iface_modem_3gpp_parent->enable_unsolicited_events (
|
||||||
self,
|
self,
|
||||||
(GAsyncReadyCallback)parent_enable_unsolicited_events_ready,
|
(GAsyncReadyCallback)parent_enable_unsolicited_events_ready,
|
||||||
result);
|
g_task_new (self, NULL, callback, user_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user