Disable redial for default.
Change-Id: I21b690e460f8706d86302a3d2d37b97912d28029
diff --git a/mbtk/include/mbtk/mbtk_ril_api.h b/mbtk/include/mbtk/mbtk_ril_api.h
index 8bf6848..352950f 100755
--- a/mbtk/include/mbtk/mbtk_ril_api.h
+++ b/mbtk/include/mbtk/mbtk_ril_api.h
@@ -80,6 +80,8 @@
MBTK_RIL_ERR_NET_CONF,
MBTK_RIL_ERR_TIMEOUT, // Timeout.
MBTK_RIL_ERR_TIME_FORMAT, // Time format error.
+ MBTK_RIL_ERR_DATA_CONNECTED, // Data call is connected.
+ MBTK_RIL_ERR_DATA_DISCONNECTED, // Data call is disconnected.
MBTK_RIL_ERR_UNKNOWN = 400, // Unknown error.
// CME error start index.
@@ -459,6 +461,7 @@
mbtk_apn_auth_type_enum auth : 8;
uint8 auto_save;
uint8 auto_boot_call;
+ uint8 redial_enable; // Support redialing or not.
uint8 def_route;
uint8 as_dns;
uint8 apn[APN_NAME_STR_MAX];
diff --git a/mbtk/mbtk_rild_v2/src/ril_data_call.c b/mbtk/mbtk_rild_v2/src/ril_data_call.c
index 5a0429c..6b1bfe1 100755
--- a/mbtk/mbtk_rild_v2/src/ril_data_call.c
+++ b/mbtk/mbtk_rild_v2/src/ril_data_call.c
@@ -525,7 +525,7 @@
memset(prop_data, 0, sizeof(prop_data));
sprintf(prop_name, "%s_%d",MBTK_APN_PROP,cid);
- // ip_type,auth,auto_data_call,apn,user,pass
+ // ip_type,auth,auto_data_call,redial_enable,apn,user,pass,type
#if 0
if(property_get(prop_name, prop_data, "") > 0 && !str_empty(prop_data)) {
#else
@@ -560,6 +560,13 @@
if(!ptr_1) {
continue;
}
+ ptr_1++; // Jump ',' to redial_enable
+
+ apns->apns[apns->num].redial_enable = (uint8)atoi(ptr_1);
+ ptr_1 = strstr(ptr_1, ",");
+ if(!ptr_1) {
+ continue;
+ }
ptr_1++; // Jump ',' to apn
// Reset auto_boot_call to 0 for CID 1.
@@ -610,7 +617,7 @@
memset(apn, 0, sizeof(mbtk_apn_info_t));
sprintf(prop_name, "%s_%d",MBTK_APN_PROP,cid);
- // ip_type,auth,auto_data_call,apn,user,pass
+ // ip_type,auth,auto_data_call,redial_enable,apn,user,pass,type
#if 0
if(property_get(prop_name, prop_data, "") > 0 && !str_empty(prop_data)) {
#else
@@ -638,6 +645,13 @@
if(!ptr_1) {
return -1;
}
+ ptr_1++; // Jump ',' to redial_enable
+
+ apn->redial_enable = (uint8)atoi(ptr_1);
+ ptr_1 = strstr(ptr_1, ",");
+ if(!ptr_1) {
+ return -1;
+ }
ptr_1++; // Jump ',' to apn
// Reset auto_boot_call to 0 for CID 1.
@@ -686,7 +700,7 @@
char prop_data[1024] = {0};
sprintf(prop_name, "%s_%d",MBTK_APN_PROP,cid);
- // ip_type,auth,auto_data_call,apn,user,pass
+ // ip_type,auth,auto_data_call,redial_enable,apn,user,pass,type
#if 0
if(property_get(prop_name, prop_data, "") > 0 && !str_empty(prop_data)) {
#else
@@ -714,6 +728,13 @@
if(!ptr_1) {
return -1;
}
+ ptr_1++; // Jump ',' to redial_enable
+
+ apn->redial_enable = (uint8)atoi(ptr_1);
+ ptr_1 = strstr(ptr_1, ",");
+ if(!ptr_1) {
+ return -1;
+ }
ptr_1++; // Jump ',' to apn
// Reset auto_boot_call to 0 for CID 1.
@@ -775,7 +796,8 @@
sprintf(prop_name, "%s_%d", MBTK_APN_PROP, apn->cid);
// Delete apn
if(!str_empty(apn->apn)) {
- snprintf(prop_data, 1024, "%d,%d,%d,%s,%s,%s,%s", apn->ip_type, apn->auth, apn->auto_boot_call,
+ snprintf(prop_data, 1024, "%d,%d,%d,%d,%s,%s,%s,%s", apn->ip_type, apn->auth, apn->auto_boot_call,
+ apn->redial_enable,
apn->apn,
str_empty(apn->user) ? "NULL" : (char*)apn->user,
str_empty(apn->pass) ? "NULL" : (char*)apn->pass,
@@ -1486,6 +1508,13 @@
if(call_info->type == MBTK_DATA_CALL_START) {
mbtk_ip_info_t ip_info;
memset(&ip_info, 0, sizeof(ip_info));
+
+ if(info_list[call_info->cid - 1].apn_info.redial_enable
+ && info_list[call_info->cid - 1].act_state == RIL_ACT_STATE_CONNECTED) {
+ err = MBTK_RIL_ERR_DATA_CONNECTED;
+ LOGW("Data call is connected.");
+ break;
+ }
#if 0
if(apn_prop_reset(call_info)) {
err = MBTK_RIL_ERR_REQ_UNKNOWN;
@@ -1547,6 +1576,13 @@
}
}
} else if(call_info->type == MBTK_DATA_CALL_STOP) {
+ if(info_list[call_info->cid - 1].apn_info.redial_enable
+ && info_list[call_info->cid - 1].act_state == RIL_ACT_STATE_DISCONNECTED) {
+ err = MBTK_RIL_ERR_DATA_DISCONNECTED;
+ LOGW("Data call is disconnected.");
+ break;
+ }
+
info_list[call_info->cid - 1].act_state = RIL_ACT_STATE_DISCONNECTING;
if(req_data_call_stop(cli_info->port, call_info->cid, call_info->timeout, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{