gsm: add access technology support for HSPA+

This commit is contained in:
Dan Williams
2011-01-01 11:55:41 -06:00
parent 657e5ac7f6
commit a502fd2b19
5 changed files with 46 additions and 34 deletions

View File

@@ -157,6 +157,9 @@
<tp:enumvalue suffix="HSPA" value="8">
<tp:docstring>HSPA (ETSI 27.007: "UTRAN w/HSDPA and HSUPA")</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="HSPA_PLUS" value="9">
<tp:docstring>HSPA+ (ETSI 27.007: "UTRAN w/HSPA+")</tp:docstring>
</tp:enumvalue>
</tp:enum>
</interface>

View File

@@ -367,6 +367,35 @@ get_band (MMModemGsmNetwork *modem,
mm_at_serial_port_queue_command (port, "AT^SYSCFG?", 3, get_band_done, info);
}
static MMModemGsmAccessTech
huawei_sysinfo_to_act (int huawei)
{
switch (huawei) {
case 1:
return MM_MODEM_GSM_ACCESS_TECH_GSM;
case 2:
return MM_MODEM_GSM_ACCESS_TECH_GPRS;
case 3:
return MM_MODEM_GSM_ACCESS_TECH_EDGE;
case 4:
return MM_MODEM_GSM_ACCESS_TECH_UMTS;
case 5:
return MM_MODEM_GSM_ACCESS_TECH_HSDPA;
case 6:
return MM_MODEM_GSM_ACCESS_TECH_HSUPA;
case 7:
return MM_MODEM_GSM_ACCESS_TECH_HSPA;
case 9:
return MM_MODEM_GSM_ACCESS_TECH_HSPA_PLUS;
case 8:
/* TD-SCDMA */
default:
break;
}
return MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
}
static void
get_act_request_done (MMAtSerialPort *port,
GString *response,
@@ -409,22 +438,8 @@ get_act_request_done (MMAtSerialPort *port,
if (srv_stat != 0) {
/* Valid service */
str = g_match_info_fetch (match_info, 7);
if (str && strlen (str)) {
if (str[0] == '1')
act = MM_MODEM_GSM_ACCESS_TECH_GSM;
else if (str[0] == '2')
act = MM_MODEM_GSM_ACCESS_TECH_GPRS;
else if (str[0] == '3')
act = MM_MODEM_GSM_ACCESS_TECH_EDGE;
else if (str[0] == '4')
act = MM_MODEM_GSM_ACCESS_TECH_UMTS;
else if (str[0] == '5')
act = MM_MODEM_GSM_ACCESS_TECH_HSDPA;
else if (str[0] == '6')
act = MM_MODEM_GSM_ACCESS_TECH_HSUPA;
else if (str[0] == '7')
act = MM_MODEM_GSM_ACCESS_TECH_HSPA;
}
if (str && strlen (str))
act = huawei_sysinfo_to_act (atoi (str));
g_free (str);
}
@@ -627,32 +642,21 @@ handle_mode_change (MMAtSerialPort *port,
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
char *str;
int a;
int b;
str = g_match_info_fetch (match_info, 1);
a = atoi (str);
g_free (str);
str = g_match_info_fetch (match_info, 2);
b = atoi (str);
act = huawei_sysinfo_to_act (atoi (str));
g_free (str);
if (a == 3) { /* GSM/GPRS mode */
if (b == 1)
act = MM_MODEM_GSM_ACCESS_TECH_GSM;
else if (b == 2)
act = MM_MODEM_GSM_ACCESS_TECH_GPRS;
else if (b == 3)
act = MM_MODEM_GSM_ACCESS_TECH_EDGE;
if (act > MM_MODEM_GSM_ACCESS_TECH_EDGE)
act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
} else if (a == 5) { /* WCDMA mode */
if (b == 4)
act = MM_MODEM_GSM_ACCESS_TECH_UMTS;
else if (b == 5)
act = MM_MODEM_GSM_ACCESS_TECH_HSDPA;
else if (b == 6)
act = MM_MODEM_GSM_ACCESS_TECH_HSUPA;
else if (b == 7)
act = MM_MODEM_GSM_ACCESS_TECH_HSPA;
if (act < MM_MODEM_GSM_ACCESS_TECH_UMTS)
act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
} else if (a == 0)
act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
else {

View File

@@ -108,6 +108,8 @@ mm_modem_gsm_network_act_to_old_mode (MMModemGsmAccessTech act)
return MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSUPA;
else if (act & MM_MODEM_GSM_ACCESS_TECH_HSPA)
return MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSPA;
else if (act & MM_MODEM_GSM_ACCESS_TECH_HSPA_PLUS)
return MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSPA;
return MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY;
}

View File

@@ -54,8 +54,9 @@ typedef enum {
MM_MODEM_GSM_ACCESS_TECH_HSDPA = 6, /* UTRAN w/HSDPA */
MM_MODEM_GSM_ACCESS_TECH_HSUPA = 7, /* UTRAN w/HSUPA */
MM_MODEM_GSM_ACCESS_TECH_HSPA = 8, /* UTRAN w/HSDPA and HSUPA */
MM_MODEM_GSM_ACCESS_TECH_HSPA_PLUS = 9, /* UTRAN w/HSPA+ */
MM_MODEM_GSM_ACCESS_TECH_LAST = MM_MODEM_GSM_ACCESS_TECH_HSPA
MM_MODEM_GSM_ACCESS_TECH_LAST = MM_MODEM_GSM_ACCESS_TECH_HSPA_PLUS
} MMModemGsmAccessTech;
typedef enum {

View File

@@ -785,7 +785,9 @@ mm_gsm_string_to_access_tech (const char *string)
/* Better technologies are listed first since modems sometimes say
* stuff like "GPRS/EDGE" and that should be handled as EDGE.
*/
if (strcasestr (string, "HSPA"))
if (strcasestr (string, "HSPA+"))
return MM_MODEM_GSM_ACCESS_TECH_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;