#define AT_COPS_ACT_UTRAN_HSUPA 5 /* UTRAN w/HSUPA */
#define AT_COPS_ACT_UTRAN_HSDPA_HSUPA 6 /* UTRAN w/HSDPA and HSUPA */
#define AT_COPS_ACT_E_UTRAN 7 /* E-UTRAN */
+#define AT_COPS_ACT_MAX 8
static unsigned int lookup_tbl_access_technology[] = {
[AT_COPS_ACT_GSM] = NETWORK_ACT_GSM,
/* <AcT> */
if ((token_str = g_slist_nth_data(tokens, 3))) {
- act = lookup_tbl_access_technology[atoi(token_str)]; /*TODO : Modify this mapping*/
+ gint idx = atoi(token_str);
+ if (idx >= 0 && idx < AT_COPS_ACT_MAX)
+ act = lookup_tbl_access_technology[idx];
+ else
+ act = NETWORK_ACT_UNKNOWN;
(void)tcore_network_set_access_technology(co_network, act);
} else {
dbg("No <AcT> in +CREG");
/* <AcT> */
if ((token_str = g_slist_nth_data(tokens, 3))) {
- act = lookup_tbl_access_technology[atoi(token_str)];
+ gint idx = atoi(token_str);
+ if (idx >= 0 && idx < AT_COPS_ACT_MAX)
+ act = lookup_tbl_access_technology[idx];
+ else
+ act = NETWORK_ACT_UNKNOWN;
(void)tcore_network_set_access_technology(co_network, act);
} else {
dbg("No <AcT> in +CGREG");
/* Parse Access Technology */
if ((resp = tcore_at_tok_nth(tokens, 4))) {
if (strlen(resp) > 0) {
- gint act = atoi(resp);
- dbg("AcT: [%d]", act);
- nw_resp.list[count].act = lookup_tbl_access_technology[act];
+ gint act = atoi(resp);
+ dbg("AcT: [%d]", act);
+ if (act >= 0 && act < AT_COPS_ACT_MAX)
+ nw_resp.list[count].act = lookup_tbl_access_technology[act];
+ else
+ nw_resp.list[count].act = NETWORK_ACT_UNKNOWN;
}
} else {
nw_resp.list[count].act = NETWORK_ACT_UMTS;
/* act */
if ((local_data = tcore_at_tok_nth(tokens, 3))) {
+ gint idx = atoi(local_data);
dbg("AcT : %s", local_data);
- act = lookup_tbl_access_technology[atoi(local_data)];
+ if (idx >= 0 && idx < AT_COPS_ACT_MAX)
+ act = lookup_tbl_access_technology[idx];
+ else
+ act = NETWORK_ACT_UNKNOWN;
}
nw_resp.act = act;