novatel-lte: fallback to parent scan method
There is no need to run +COPS=? in the same way as the parent does it, just fallback to the parent implementation.
This commit is contained in:

committed by
Dan Williams

parent
baa68f5a4a
commit
a23040756b
@@ -38,6 +38,8 @@
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
|
||||
|
||||
static MMIfaceModem3gpp *iface_modem_3gpp_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemNovatelLte, mm_broadband_modem_novatel_lte, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init));
|
||||
@@ -571,28 +573,17 @@ scan_networks_finish (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
cops_query_ready (MMBroadbandModemNovatelLte *self,
|
||||
parent_scan_networks_ready (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
GList *scan_result;
|
||||
|
||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||
if (error) {
|
||||
scan_result = iface_modem_3gpp_parent->scan_networks_finish (self, res, &error);
|
||||
if (!scan_result)
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
scan_result = mm_3gpp_parse_cops_test_response (response, &error);
|
||||
if (error) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
g_task_return_pointer (task,
|
||||
scan_result,
|
||||
(GDestroyNotify)mm_3gpp_network_info_list_free);
|
||||
@@ -611,11 +602,11 @@ scan_networks (MMIfaceModem3gpp *self,
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
access_tech = mm_iface_modem_get_access_technologies (MM_IFACE_MODEM (self));
|
||||
/* The Novatel LTE modem does not properly support AT+COPS=? in LTE mode.
|
||||
* Thus, do not try to scan networks when the current access technologies
|
||||
* include LTE.
|
||||
*/
|
||||
access_tech = mm_iface_modem_get_access_technologies (MM_IFACE_MODEM (self));
|
||||
if (access_tech & MM_MODEM_ACCESS_TECHNOLOGY_LTE) {
|
||||
gchar *access_tech_string;
|
||||
|
||||
@@ -631,11 +622,9 @@ scan_networks (MMIfaceModem3gpp *self,
|
||||
return;
|
||||
}
|
||||
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+COPS=?",
|
||||
300,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)cops_query_ready,
|
||||
/* Otherwise, just fallback to the generic scan method */
|
||||
iface_modem_3gpp_parent->scan_networks (self,
|
||||
(GAsyncReadyCallback)parent_scan_networks_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
@@ -691,6 +680,8 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
static void
|
||||
iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
|
||||
{
|
||||
iface_modem_3gpp_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->scan_networks = scan_networks;
|
||||
iface->scan_networks_finish = scan_networks_finish;
|
||||
}
|
||||
|
Reference in New Issue
Block a user