[datacall]Bug 85777 qser_apn_del
Change-Id: I3013d46fdf8ee42bb320f267667f90f4184ae840
diff --git a/mbtk/liblynq_lib/src/lynq_data_call.c b/mbtk/liblynq_lib/src/lynq_data_call.c
old mode 100755
new mode 100644
index 1d886f3..e8dc0af
--- a/mbtk/liblynq_lib/src/lynq_data_call.c
+++ b/mbtk/liblynq_lib/src/lynq_data_call.c
@@ -1254,6 +1254,8 @@
int qser_apn_del(unsigned char profile_idx)
{
+ int ret = 0;
+
//UNUSED(profile_idx);
if(qser_info_handle == NULL)
{
@@ -1273,6 +1275,14 @@
return QSER_RESULT_FAIL;
}
+ ret = mbtk_apn_del(qser_info_handle, profile_idx);
+
+ if(ret < 0)
+ {
+ LOGE("mbtk_apn_del fail!");
+ return QSER_RESULT_FAIL;
+ }
+
qser_apn_info_state[profile_idx] = FALSE;
qser_apn_add_save_state[profile_idx] = '0';
diff --git a/mbtk/libmbtk_ril/mbtk_info.h b/mbtk/libmbtk_ril/mbtk_info.h
old mode 100755
new mode 100644
index a8a2b91..9bbf844
--- a/mbtk/libmbtk_ril/mbtk_info.h
+++ b/mbtk/libmbtk_ril/mbtk_info.h
@@ -125,6 +125,9 @@
// mbtk_apn_info_t
MBTK_INFO_ID_NET_APN_REQ,
MBTK_INFO_ID_NET_APN_RSP,
+ // mbtk_apn_del
+ MBTK_INFO_ID_NET_APN_DEL_REQ,
+ MBTK_INFO_ID_NET_APN_DEL_RSP,
// mbtk_cell_info_t[]
MBTK_INFO_ID_NET_CELL_REQ,
MBTK_INFO_ID_NET_CELL_RSP,
diff --git a/mbtk/libmbtk_ril/mbtk_info_api.c b/mbtk/libmbtk_ril/mbtk_info_api.c
old mode 100755
new mode 100644
index d471c3b..ac21898
--- a/mbtk/libmbtk_ril/mbtk_info_api.c
+++ b/mbtk/libmbtk_ril/mbtk_info_api.c
@@ -1213,6 +1213,29 @@
return info_item_process(handle, MBTK_INFO_ID_NET_APN_REQ, data, ptr - data, NULL) ? handle->info_err : 0;
}
+int mbtk_apn_del(mbtk_info_handle_t* handle, unsigned char profile_idx)
+{
+ char profile[2];
+ memset(profile, 0, 2);
+ sprintf(profile, "%s", profile_idx);
+ if(handle == NULL)
+ {
+ LOGE("ARG error.");
+ return -1;
+ }
+
+ if(info_item_process(handle, MBTK_INFO_ID_NET_APN_DEL_REQ, profile, strlen(profile), NULL) >= 0)
+ {
+ LOG("profile_idx Number : %s", profile);
+ return 0;
+ }
+ else
+ {
+ return handle->info_err;
+ }
+
+}
+
/*
* Start data call.
*/
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
old mode 100755
new mode 100644
index 47c5ba7..5fca1ea
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -3417,6 +3417,25 @@
return err;
}
+static int req_apn_del(char *data, int *cme_err)
+{
+ ATResponse *response = NULL;
+ char cmd[64]={0};
+ sprintf(cmd, "AT+CGDCONT=%s", data);
+ int err = at_send_command(cmd, &response);
+ if (err < 0 || response->success == 0){
+ if(cme_err) {
+ *cme_err = at_get_cme_error(response);
+ }
+ goto exit;
+ }
+
+exit:
+ at_response_free(response);
+ return err;
+}
+
+
int wait_cgact_complete(int timeout)
{
int count = timeout * 10; // timeout * 1000 / 100
@@ -4959,6 +4978,34 @@
}
break;
}
+ case MBTK_INFO_ID_NET_APN_DEL_REQ:
+ {
+ if(pack->data_len == 0 || pack->data == NULL)
+ {
+ err = MBTK_INFO_ERR_UNSUPPORTED;
+ LOG("Unsupported delete apn .");
+ }
+ else
+ {
+ char profile[2];
+ memset(profile, 0, 2);
+ memcpy(profile, pack->data, pack->data_len);
+ if(req_apn_del(profile, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
+ {
+ if(cme_err != MBTK_INFO_ERR_CME_NON) {
+ err = MBTK_INFO_ERR_CME + cme_err;
+ } else {
+ err = MBTK_INFO_ERR_UNKNOWN;
+ }
+ LOG("Delete apn fail.");
+ }
+ else
+ {
+ pack_rsp_send(cli_info->fd, MBTK_INFO_ID_NET_APN_DEL_RSP, NULL, 0);
+ }
+ }
+ break;
+ }
case MBTK_INFO_ID_NET_DATA_CALL_REQ:
{
if(pack->data_len == 0 || pack->data == NULL)