iridium: port setup_flow_control to use GTask
This commit is contained in:
committed by
Aleksander Morgado
parent
aee8bcc748
commit
2768df24b4
@@ -168,25 +168,24 @@ setup_flow_control_finish (MMIfaceModem *self,
|
||||
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 void
|
||||
setup_flow_control_ready (MMBroadbandModemIridium *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *operation_result)
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error))
|
||||
/* Let the error be critical. We DO need RTS/CTS in order to have
|
||||
* proper modem disabling. */
|
||||
g_simple_async_result_take_error (operation_result, error);
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_simple_async_result_set_op_res_gboolean (operation_result, TRUE);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
|
||||
g_simple_async_result_complete (operation_result);
|
||||
g_object_unref (operation_result);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -194,13 +193,6 @@ setup_flow_control (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
setup_flow_control);
|
||||
|
||||
/* Enable RTS/CTS flow control.
|
||||
* Other available values:
|
||||
* AT&K0: Disable flow control
|
||||
@@ -213,7 +205,7 @@ setup_flow_control (MMIfaceModem *self,
|
||||
3,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)setup_flow_control_ready,
|
||||
result);
|
||||
g_task_new (self, NULL, callback, user_data));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user