aboutsummaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-02-19 10:49:36 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-16 14:28:14 +0100
commit1359c0a9282d46f7cc84786bd2a5ac6033d371d8 (patch)
treea5dc3224c93334f6da955562a0460cf0511c91fe /src/mm-modem-helpers.c
parent4315208cfa572d83f5c385f746de8bde46aa2f45 (diff)
modem-helpers: updated the string to access technology converter
We can now return a mask of flags specifying more than one access technology, and therefore the order is not really important any more, unless for special cases like looking for substrings of valid expected strings (e.g "HSPA" and "HSPA+"). Also, add "LTE" in the list of expected strings.
Diffstat (limited to 'src/mm-modem-helpers.c')
-rw-r--r--src/mm-modem-helpers.c57
1 files changed, 33 insertions, 24 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 2e4c33e2..1fb5fa94 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -1350,34 +1350,43 @@ mm_gsm_parse_clck_response (const char *reply, gboolean *enabled)
/*************************************************************************/
-MMModemGsmAccessTech
-mm_gsm_string_to_access_tech (const char *string)
+MMModemAccessTechnology
+mm_3gpp_string_to_access_tech (const gchar *string)
{
- g_return_val_if_fail (string != NULL, MM_MODEM_GSM_ACCESS_TECH_UNKNOWN);
+ MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
+
+ g_return_val_if_fail (string != NULL, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
+
+ /* We're returning a MASK of technologies found; so we can include more
+ * than one technology in the result */
+ if (strcasestr (string, "LTE"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_LTE;
- /* Better technologies are listed first since modems sometimes say
- * stuff like "GPRS/EDGE" and that should be handled as EDGE.
- */
if (strcasestr (string, "HSPA+"))
- return MM_MODEM_GSM_ACCESS_TECH_HSPA_PLUS;
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS;
else if (strcasestr (string, "HSPA"))
- return MM_MODEM_GSM_ACCESS_TECH_HSPA;
- else if (strcasestr (string, "HSDPA/HSUPA"))
- return MM_MODEM_GSM_ACCESS_TECH_HSPA;
- else if (strcasestr (string, "HSUPA"))
- return MM_MODEM_GSM_ACCESS_TECH_HSUPA;
- else if (strcasestr (string, "HSDPA"))
- return MM_MODEM_GSM_ACCESS_TECH_HSDPA;
- else if (strcasestr (string, "UMTS"))
- return MM_MODEM_GSM_ACCESS_TECH_UMTS;
- else if (strcasestr (string, "EDGE"))
- return MM_MODEM_GSM_ACCESS_TECH_EDGE;
- else if (strcasestr (string, "GPRS"))
- return MM_MODEM_GSM_ACCESS_TECH_GPRS;
- else if (strcasestr (string, "GSM"))
- return MM_MODEM_GSM_ACCESS_TECH_GSM;
-
- return MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_HSPA;
+
+
+ if (strcasestr (string, "HSUPA"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_HSUPA;
+
+ if (strcasestr (string, "HSDPA"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_HSDPA;
+
+ if (strcasestr (string, "UMTS"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_UMTS;
+
+ if (strcasestr (string, "EDGE"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_EDGE;
+
+ if (strcasestr (string, "GPRS"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_GPRS;
+
+ if (strcasestr (string, "GSM"))
+ act |= MM_MODEM_ACCESS_TECHNOLOGY_GSM;
+
+ return act;
}
/*************************************************************************/