helpers: add generic helper for string -> access technology
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
* Copyright (C) 2009 - 2010 Red Hat, Inc.
|
* Copyright (C) 2009 - 2010 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -770,3 +771,33 @@ mm_gsm_parse_cscs_support_response (const char *reply,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
MMModemGsmAccessTech
|
||||||
|
mm_gsm_string_to_access_tech (const char *string)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (string != NULL, MM_MODEM_GSM_ACCESS_TECH_UNKNOWN);
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#define MM_MODEM_HELPERS_H
|
#define MM_MODEM_HELPERS_H
|
||||||
|
|
||||||
#include "mm-modem-cdma.h"
|
#include "mm-modem-cdma.h"
|
||||||
|
#include "mm-modem-gsm.h"
|
||||||
#include "mm-charsets.h"
|
#include "mm-charsets.h"
|
||||||
|
|
||||||
#define MM_SCAN_TAG_STATUS "status"
|
#define MM_SCAN_TAG_STATUS "status"
|
||||||
@@ -55,5 +56,7 @@ gboolean mm_cdma_parse_speri_response (const char *reply,
|
|||||||
gboolean mm_gsm_parse_cscs_support_response (const char *reply,
|
gboolean mm_gsm_parse_cscs_support_response (const char *reply,
|
||||||
MMModemCharset *out_charsets);
|
MMModemCharset *out_charsets);
|
||||||
|
|
||||||
|
MMModemGsmAccessTech mm_gsm_string_to_access_tech (const char *string);
|
||||||
|
|
||||||
#endif /* MM_MODEM_HELPERS_H */
|
#endif /* MM_MODEM_HELPERS_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user