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