update data_call callback param
Change-Id: I0ce6612fd1a792490063ad6db2482748b655b4f0
diff --git a/mbtk/mbtk_rild/src/main.c b/mbtk/mbtk_rild/src/main.c
index 22e739c..a527ed1 100755
--- a/mbtk/mbtk_rild/src/main.c
+++ b/mbtk/mbtk_rild/src/main.c
@@ -217,9 +217,9 @@
cgact_wait.waitting = false;
}
- uint8 data_pdp;
- data_pdp = 1; //
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
+ //uint8 data_pdp;
+ //data_pdp = 1; //
+ //urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
}
// +CGEV:
// +CGEV: NW DEACT <cid>,<cid>
@@ -240,14 +240,23 @@
// +CGEV: NW REATTACH
else if(strStartsWith(s, "+CGEV:"))
{
- if(at_process && !at_cfun_command) {
- if(cgact_wait.act) {
- if(strStartsWith(s, "+CGEV: ME PDN ACT ")) { // +CGEV: ME PDN ACT 15,4
- if(cgact_wait.cid == atoi(s + 18)) {
+ if(at_process && !at_cfun_command)
+ {
+ mbtk_pdp_cb_info_s pdp_cb_info;
+ memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
+ pdp_cb_info.auto_urc = false;
+ if(cgact_wait.act)
+ {
+ if(strStartsWith(s, "+CGEV: ME PDN ACT ")) // +CGEV: ME PDN ACT 15,4
+ {
+ if(cgact_wait.cid == atoi(s + 18))
+ {
cgact_wait.waitting = false;
}
- uint8 data_pdp;
+ pdp_cb_info.cid = atoi(s + 18);
+ pdp_cb_info.connect_state = true;
+#if 0
char* tmp_s = memdup(s + 18,strlen(s + 18));
char* free_ptr = tmp_s;
char *line = tmp_s;
@@ -264,10 +273,10 @@
{
goto at_PDP_CREG_EXIT;
}
- data_pdp = tmp_int;
+ pdp_cb_info.pdp_result = tmp_int;
at_PDP_CREG_EXIT:
free(free_ptr);
-
+ free_ptr = NULL;
//data_pdp = (uint8)atoi(s + 20); //reason
if(cgact_wait.cid >= 1 && cgact_wait.cid < 8)
{
@@ -302,71 +311,69 @@
urc_msg_distribute(true, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
}
}
- } else if(strStartsWith(s, "+CGEV: NW MODIFY ")) { // +CGEV: NW MODIFY 1,4
- if(cgact_wait.cid == atoi(s + 17)) {
- cgact_wait.waitting = false;
- }
+#endif
+ urc_msg_distribute(true, INFO_URC_MSG_PDP_STATE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
}
- } else {
- if(strStartsWith(s, "+CGEV: ME PDN DEACT ")) { // +CGEV: ME PDN DEACT 1
- if(cgact_wait.cid == atoi(s + 20)) {
+ else if(strStartsWith(s, "+CGEV: NW MODIFY ")) // +CGEV: NW MODIFY 1,4
+ {
+ if(cgact_wait.cid == atoi(s + 17))
+ {
cgact_wait.waitting = false;
}
- uint8 data_pdp;
- data_pdp = 0; //
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
- if(cgact_wait.cid != 0)
+
+ pdp_cb_info.cid = atoi(s + 17);
+ pdp_cb_info.connect_state = true;
+ //urc_msg_distribute(true, INFO_URC_MSG_PDP_STATE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+ }
+ }
+ else
+ {
+ if(strStartsWith(s, "+CGEV: ME PDN DEACT ")) // +CGEV: ME PDN DEACT 1
+ {
+ if(cgact_wait.cid == atoi(s + 20))
{
- data_pdp = cgact_wait.cid + 100;
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
+ cgact_wait.waitting = false;
}
+
+ pdp_cb_info.cid = atoi(s + 20);
+ pdp_cb_info.connect_state = false;
+ urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
}
}
- } else {
- // apn_state_set
-
+ }
+ else
+ {
// +CGEV: NW PDN DEACT <cid>
-
// +CGEV: EPS PDN ACT 1
// +CGEV: ME PDN ACT 8,1
-
// +CGEV: ME PDN ACT 2,4
- uint8 data[2] = {0xFF};
- if(strStartsWith(s, "+CGEV: NW PDN DEACT ")) { // +CGEV: NW PDN DEACT <cid>
- //apn_state_set(atoi(s + 20), false);
- data[0] = (uint8)0;
- data[1] = (uint8)atoi(s + 20);
+ mbtk_pdp_cb_info_s pdp_cb_info;
+ memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
+ pdp_cb_info.auto_urc = true;
+ if(strStartsWith(s, "+CGEV: NW PDN DEACT ")) // +CGEV: NW PDN DEACT <cid>
+ {
+ pdp_cb_info.cid = (uint8)atoi(s + 20);
+ pdp_cb_info.connect_state = false;
+ urc_msg_distribute(true, INFO_URC_MSG_CGEV, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+ }
+ else if(strStartsWith(s, "+CGEV: EPS PDN ACT ")) // +CGEV: EPS PDN ACT <cid>
+ {
+ pdp_cb_info.cid = (uint8)atoi(s + 19);
+ pdp_cb_info.connect_state = true;
+ }
+ else if(strStartsWith(s, "+CGEV: ME PDN DEACT ")) // +CGEV: EPS PDN DEACT <cid>
+ {
+ pdp_cb_info.cid = (uint8)atoi(s + 20);
+ pdp_cb_info.connect_state = false;
+ urc_msg_distribute(true, INFO_URC_MSG_CGEV, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+ }
+ else if(strStartsWith(s, "+CGEV: ME PDN ACT ")) // +CGEV: ME PDN ACT <cid>,1
+ {
+ pdp_cb_info.cid = (uint8)atoi(s + 18);
+ pdp_cb_info.connect_state = true;
+ //urc_msg_distribute(true, INFO_URC_MSG_PDP_STATE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
- uint8 data_pdp;
- data_pdp = 0; //
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
- data_pdp = data[1] + 100;
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
- } else if(strStartsWith(s, "+CGEV: EPS PDN ACT ")) { // +CGEV: EPS PDN ACT <cid>
- //apn_state_set(atoi(s + 19), true);
-#if (defined(MBTK_AF_SUPPORT) || defined(MBTK_ALL_CID_SUPPORT))
- //data[0] = (uint8)1;
- //data[1] = (uint8)atoi(s + 19);
-#else
- data[0] = (uint8)1;
- data[1] = (uint8)atoi(s + 19);
-#endif
- } else if(strStartsWith(s, "+CGEV: ME PDN DEACT ")) { // +CGEV: EPS PDN DEACT <cid>
- //apn_state_set(atoi(s + 19), true);
- data[0] = (uint8)0;
- data[1] = (uint8)atoi(s + 20);
-
- uint8 data_pdp;
- data_pdp = 0; //
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
- data_pdp = data[1] + 100;
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
- } else if(strStartsWith(s, "+CGEV: ME PDN ACT ")) { // +CGEV: ME PDN ACT <cid>,1
- //apn_state_set(atoi(s + 18), true);
- data[0] = (uint8)1;
- data[1] = (uint8)atoi(s + 18);
-
- uint8 data_pdp;
+#if 0
char* tmp_s = memdup(s + 18,strlen(s + 18));
char* free_ptr = tmp_s;
char *line = tmp_s;
@@ -413,16 +420,19 @@
{
}
-
data_pdp = data[1] + 200;
urc_msg_distribute(true, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
data[1] = 0;
}
- } else {
+#endif
+
+ }
+ else
+ {
LOGI("No process : %s", s);
}
- urc_msg_distribute(true, INFO_URC_MSG_CGEV, data, sizeof(uint8) * 2);
+ //urc_msg_distribute(true, INFO_URC_MSG_CGEV, data, sizeof(uint8) * 2);
}
}
// +CREG: 1, "8010", "000060a5", 0, 2, 0
@@ -520,12 +530,14 @@
} else {
data[2] = (uint8)0xFF; // AcT
}
+#if 0
if(data[1] == 5)
{
uint8 data_pdp;
data_pdp = 5; //
urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
}
+#endif
urc_msg_distribute(false, INFO_URC_MSG_NET_CS_REG_STATE, data, sizeof(data));
urc_msg_distribute(true, INFO_URC_MSG_NET_STATE_LOG, NULL, 0);
CREG_EXIT:
@@ -686,12 +698,14 @@
sim_info_reg.sim = 0;
else if(strStartsWith(s, "*SIMDETEC:1,SIM"))
sim_info_reg.sim = 1;
+#if 0
if(sim_info_reg.sim == 0)
{
uint8 data_pdp;
data_pdp = 11; //
urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
}
+#endif
urc_msg_distribute(false, INFO_URC_MSG_SIM_STATE, &sim_info_reg, sizeof(mbtk_sim_card_info));
}
// *EUICC:1
@@ -814,14 +828,14 @@
}
else
sim_info_reg.sim = 20;
-
+#if 0
if(sim_info_reg.sim == 18)
{
uint8 data_pdp;
data_pdp = 11; //
urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
}
-
+#endif
urc_msg_distribute(false, INFO_URC_MSG_SIM_STATE, &sim_info_reg, sizeof(mbtk_sim_card_info));
}
// +CMT: ,23
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 5c1469a..48d3a7a 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -5709,6 +5709,19 @@
cid_active[cid] = 1;
mbtk_set_default_pdp_state(true, cid);
mbtk_qser_route_config(cid, &ipv4, &ipv6);
+#ifdef MBTK_ALL_CID_SUPPORT
+ if(cid == 1) //cid 1 as a special treatment
+ {
+ mbtk_pdp_cb_info_s pdp_cb_info;
+ memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
+ pdp_cb_info.cid = cid;
+ pdp_cb_info.auto_urc = false;
+ pdp_cb_info.connect_state = true;
+ memcpy(&(pdp_cb_info.ipv4), &ipv4, sizeof(mbtk_ipv4_info_t));
+ memcpy(&(pdp_cb_info.ipv6), &ipv6, sizeof(mbtk_ipv6_info_t));
+ pack_rsp_send(cli_info->fd , MBTK_INFO_ID_IND_PDP_STATE_CHANGE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+ }
+#endif
if(cli_info->fd != DATA_CALL_BOOTCONN_FD)
{
mbtk_net_led_set(MBTK_NET_LED_DATA_CONNECT);
@@ -5738,8 +5751,8 @@
if(cid == 1)
{
char dev[20] = {0};
- uint8 pdp_data = cid + 100;
- pack_rsp_send(cli_info->fd , MBTK_INFO_ID_IND_PDP_STATE_CHANGE, &pdp_data, sizeof(uint8));
+ mbtk_pdp_cb_info_s pdp_cb_info;
+ memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
sprintf(dev, "ccinet%d", cid - 1);
@@ -5749,6 +5762,11 @@
} else {
LOGD("Config %s IPv4 0 success.", dev);
}
+ pdp_cb_info.cid = cid;
+ pdp_cb_info.connect_state = false;
+ pdp_cb_info.auto_urc = false;
+ pack_rsp_send(cli_info->fd , MBTK_INFO_ID_IND_PDP_STATE_CHANGE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+
cid_active[cid] = 0;
mbtk_set_default_pdp_state(false, cid);
mbtk_net_led_set(MBTK_NET_LED_NET_CONNECT);
@@ -6765,7 +6783,7 @@
}
*/
-static void net_ifc_state_change(bool act, int cid, mbtk_pdp_act_info_t *act_info)
+static void net_ifc_state_change(bool act, int cid, mbtk_pdp_cb_info_s *pdp_cb_info)
{
if(cid < MBTK_APN_CID_MIN || cid > MBTK_APN_CID_MAX) { // No nothing for cid 1 and 8
return;
@@ -6815,9 +6833,9 @@
}
#endif
- if(act_info) {
- memcpy(&(act_info->ipv4), &ipv4, sizeof(mbtk_ipv4_info_t));
- memcpy(&(act_info->ipv6), &ipv6, sizeof(mbtk_ipv6_info_t));
+ if(pdp_cb_info) {
+ memcpy(&(pdp_cb_info->ipv4), &ipv4, sizeof(mbtk_ipv4_info_t));
+ memcpy(&(pdp_cb_info->ipv6), &ipv6, sizeof(mbtk_ipv6_info_t));
}
// Config IPv4 address.
@@ -6885,33 +6903,34 @@
#endif
// +CGACT
int cid;
- uint8 data_pdp = 0;
+ mbtk_pdp_cb_info_s pdp_cb_info;
LOGD("Start active APN.");
- at_process = true;
+ //at_process = true;
cgact_wait.act = true;
- for(cid = MBTK_APN_CID_MIN; cid <= MBTK_APN_CID_MAX; cid++) {
+ for(cid = MBTK_APN_CID_MIN; cid <= MBTK_APN_CID_MAX; cid++)
+ {
if(cid_active[cid])
{
LOG("Active cid : %d", cid);
+ memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
cgact_wait.waitting = true;
cgact_wait.cid = cid;
+
net_ifc_state_change(false, cid, NULL);
- data_pdp = cid + 100;
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
+ pdp_cb_info.cid = cid;
+ pdp_cb_info.connect_state = false;
+ pdp_cb_info.auto_urc = true;
+ urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+
req_data_call_start(cid, NULL);
wait_cgact_complete(10);
-
- mbtk_pdp_act_info_t act_info;
- memset(&act_info, 0, sizeof(mbtk_pdp_act_info_t));
- data_pdp = cid + 220;
- act_info.state = data_pdp;
-
- net_ifc_state_change(true, cid, &act_info);
-
- urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &act_info, sizeof(mbtk_pdp_act_info_t));
+
+ net_ifc_state_change(true, cid, &pdp_cb_info);
+ pdp_cb_info.connect_state = true;
+ urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
}
}
- at_process = false;
+ //at_process = false;
}
static void urc_msg_process(info_urc_msg_t *msg)
@@ -6932,32 +6951,21 @@
}
case INFO_URC_MSG_CGEV:
{
- bool act = data[0];
- int cid = data[1];
- if(cid > 0) {
- net_ifc_state_change(act, cid, NULL);
- }
+ mbtk_pdp_cb_info_s *pdp_cb_info = (mbtk_pdp_cb_info_s *)(msg->data);
+ net_ifc_state_change(pdp_cb_info->connect_state, pdp_cb_info->cid, NULL);
+ pdp_state_change(pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
break;
}
case INFO_URC_MSG_PDP_STATE:
{
- // pdp_state_change
- mbtk_pdp_act_info_t act_info;
- memset(&act_info, 0, sizeof(mbtk_pdp_act_info_t));
+ //data call connect success
int cme_err = MBTK_INFO_ERR_CME_NON;
- uint8 cid = *((uint8*)(msg->data));
- act_info.state = cid;
-#if 0
- if(cid > 220) {
- cid -= 220;
- } else { // > 200
- cid -= 200;
- }
-#endif
- if(!req_data_call_state_get(cid, &(act_info.ipv4), &(act_info.ipv6), &cme_err) && cme_err == MBTK_INFO_ERR_CME_NON)
+ mbtk_pdp_cb_info_s *pdp_cb_info = (mbtk_pdp_cb_info_s *)(msg->data);
+ if(req_data_call_state_get(pdp_cb_info->cid, &(pdp_cb_info->ipv4), &(pdp_cb_info->ipv6), &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
{
- pdp_state_change(&act_info, sizeof(mbtk_pdp_act_info_t));
+ LOGE("[%s] req_data_call_state_get() fail.[%d]", __func__, cme_err);
}
+ pdp_state_change(pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
break;
}
case INFO_URC_MSG_NET_PS_REG_STATE: