ublox: fix current bands loading completion
If both UACT and UBANDSEL are unsupported, the async operation was never completed.
This commit is contained in:
@@ -175,8 +175,8 @@ load_supported_bands (MMIfaceModem *self,
|
|||||||
GArray *bands = NULL;
|
GArray *bands = NULL;
|
||||||
const gchar *model;
|
const gchar *model;
|
||||||
|
|
||||||
model = mm_iface_modem_get_model (MM_BROADBAND_MODEM_UBLOX (self));
|
model = mm_iface_modem_get_model (self);
|
||||||
task = g_task_new (_self, NULL, callback, user_data);
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
|
|
||||||
bands = mm_ublox_get_supported_bands (model, &error);
|
bands = mm_ublox_get_supported_bands (model, &error);
|
||||||
if (!bands)
|
if (!bands)
|
||||||
@@ -190,23 +190,67 @@ load_supported_bands (MMIfaceModem *self,
|
|||||||
/* Load current bands (Modem interface) */
|
/* Load current bands (Modem interface) */
|
||||||
|
|
||||||
static GArray *
|
static GArray *
|
||||||
load_current_bands_finish (MMIfaceModem *_self,
|
load_current_bands_finish (MMIfaceModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
|
return (GArray *) g_task_propagate_pointer (G_TASK (res), error);
|
||||||
const gchar *response;
|
}
|
||||||
const gchar *model;
|
|
||||||
|
|
||||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
|
static void
|
||||||
model = mm_iface_modem_get_model (_self);
|
uact_load_current_bands_ready (MMBaseModem *self,
|
||||||
if (!response)
|
GAsyncResult *res,
|
||||||
return NULL;
|
GTask *task)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
const gchar *response;
|
||||||
|
GArray *out;
|
||||||
|
|
||||||
if (self->priv->support_config.uact == FEATURE_SUPPORTED)
|
response = mm_base_modem_at_command_finish (self, res, &error);
|
||||||
return mm_ublox_parse_uact_response (response, error);
|
if (!response) {
|
||||||
|
g_task_return_error (task, error);
|
||||||
|
g_object_unref (task);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return mm_ublox_parse_ubandsel_response (response, model, error);
|
out = mm_ublox_parse_uact_response (response, &error);
|
||||||
|
if (!out) {
|
||||||
|
g_task_return_error (task, error);
|
||||||
|
g_object_unref (task);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_task_return_pointer (task, out, (GDestroyNotify)g_array_unref);
|
||||||
|
g_object_unref (task);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ubandsel_load_current_bands_ready (MMBaseModem *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GTask *task)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
const gchar *response;
|
||||||
|
const gchar *model;
|
||||||
|
GArray *out;
|
||||||
|
|
||||||
|
response = mm_base_modem_at_command_finish (self, res, &error);
|
||||||
|
if (!response) {
|
||||||
|
g_task_return_error (task, error);
|
||||||
|
g_object_unref (task);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
model = mm_iface_modem_get_model (MM_IFACE_MODEM (self));
|
||||||
|
out = mm_ublox_parse_ubandsel_response (response, model, &error);
|
||||||
|
if (!out) {
|
||||||
|
g_task_return_error (task, error);
|
||||||
|
g_object_unref (task);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_task_return_pointer (task, out, (GDestroyNotify)g_array_unref);
|
||||||
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -215,17 +259,20 @@ load_current_bands (MMIfaceModem *_self,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
|
MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
|
||||||
|
GTask *task;
|
||||||
|
|
||||||
preload_support_config (self);
|
preload_support_config (self);
|
||||||
|
|
||||||
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
|
|
||||||
if (self->priv->support_config.ubandsel == FEATURE_SUPPORTED) {
|
if (self->priv->support_config.ubandsel == FEATURE_SUPPORTED) {
|
||||||
mm_base_modem_at_command (
|
mm_base_modem_at_command (
|
||||||
MM_BASE_MODEM (self),
|
MM_BASE_MODEM (self),
|
||||||
"+UBANDSEL?",
|
"+UBANDSEL?",
|
||||||
3,
|
3,
|
||||||
FALSE,
|
FALSE,
|
||||||
(GAsyncReadyCallback)callback,
|
(GAsyncReadyCallback)ubandsel_load_current_bands_ready,
|
||||||
user_data);
|
task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,10 +282,14 @@ load_current_bands (MMIfaceModem *_self,
|
|||||||
"+UACT?",
|
"+UACT?",
|
||||||
3,
|
3,
|
||||||
FALSE,
|
FALSE,
|
||||||
(GAsyncReadyCallback)callback,
|
(GAsyncReadyCallback)uact_load_current_bands_ready,
|
||||||
user_data);
|
task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||||
|
"loading current bands is unsupported");
|
||||||
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user