Add mbtk_source git commit info

Change-Id: I9867613657db269bba81d28c4b3712062ae41bdd
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 24a74a3..7f68de3 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -52,6 +52,7 @@
 ril_band_info_t band_info;

 ril_info_t ril_info;

 extern mbtk_cell_pack_info_t cell_info;

+extern ril_cgact_wait_t cgact_wait;

 

 // int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, void *data, int data_len);

 // int mbtk_signal_log(char *data);

@@ -282,7 +283,297 @@
     }
 }

 

-static void urc_cell_process(const char *s, const char *sms_pdu)

+static void urc_pdp_state_process(const char *s, const char *sms_pdu)

+{

+    // "CONNECT"

+    if(strStartsWith(s, "CONNECT"))

+    {

+#if 1

+        if(cgact_wait.waitting && cgact_wait.act) {

+            cgact_wait.waitting = false;

+        }

+#endif

+    }

+    // +CGEV:

+    // +CGEV: NW DEACT <cid>,<cid>

+    // +CGEV: ME DEACT <cid>,<cid>

+    // +CGEV: NW PDN DEACT <cid>

+    // +CGEV: ME PDN DEACT <cid>

+    // +CGEV: NW DETACH

+    // +CGEV: ME DETACH

+    //

+    // +CGEV: NW ACT <cid>,<cid>

+    // +CGEV: ME ACT <cid>,<cid>

+    // +CGEV: EPS PDN ACT <cid>

+    // +CGEV: ME PDN ACT <cid>,<reason>,<cid>

+    // +CGEV: ME PDN ACT <cid>,<reason>

+    // +CGEV: NW PDN ACT <cid>

+    // +CGEV: EPS ACT <cid>

+    // +CGEV: NW MODIFY <cid>,<reason>

+    // +CGEV: NW REATTACH

+

+    /*

+    +CGEV: NW DETACH

+    +CGEV: ME DETACH

+    +CGEV: NW CLASS <class>

+    +CGEV: ME CLASS <class>

+    +CGEV: NW PDN ACT <cid>

+    +CGEV: ME PDN ACT <cid>[,<reason>[,<cid_other>]]

+    +CGEV: NW ACT <p_cid>, <cid>, <event_type>

+    +CGEV: ME ACT <p_cid>, <cid>, <event_type>

+    +CGEV: NW DEACT <PDP_type>, <PDP_addr>, [<cid>]

+    +CGEV: ME DEACT <PDP_type>, <PDP_addr>, [<cid>]

+    +CGEV: NW PDN DEACT <cid>

+    +CGEV: NW DEACT <PDP_type>, <PDP_addr>, [<cid>]

+    +CGEV: ME PDN DEACT <cid>

+    +CGEV: ME DEACT <PDP_type>, <PDP_addr>, [<cid>]

+    +CGEV: NW DEACT <p_cid>, <cid>, <event_type>

+    +CGEV: NW DEACT <PDP_type>, <PDP_addr>, [<cid>]

+    +CGEV: ME DEACT <p_cid>, <cid>, <event_type>

+    +CGEV: ME DEACT <PDP_type>, <PDP_addr>, [<cid>]

+    +CGEV: NW MODIFY <cid>, <change_reason>, <event_type>

+    +CGEV: ME MODIFY <cid>, <change_reason>, <event_type>

+    +CGEV: REJECT <PDP_type>, <PDP_addr>

+    +CGEV: NW REACT <PDP_type>, <PDP_addr>, [<cid>]

+    */

+    else if(strStartsWith(s, "+CGEV:"))

+    {

+#if 1

+        // "+CGEV: ME PDN ACT ")) { // +CGEV: ME PDN ACT <cid>[,<reason>[,<cid_other>]]

+        // "+CGEV: NW MODIFY ")) { //  +CGEV: NW MODIFY <cid>, <change_reason>, <event_type>

+        // "+CGEV: ME PDN DEACT ")) { // +CGEV: ME PDN DEACT 1

+        // "+CGEV: NW PDN DEACT ")) { // +CGEV: NW PDN DEACT <cid>

+        // "+CGEV: EPS PDN ACT ")) { // +CGEV: EPS PDN ACT <cid>

+        // "+CGEV: ME PDN DEACT ")) { // +CGEV: EPS PDN DEACT <cid>

+        // "+CGEV: ME PDN ACT ")) { // +CGEV: ME PDN ACT <cid>,1

+        int cid = -1;

+        int reason = -1;

+        bool act = FALSE;

+        if (sscanf(s, "+CGEV: NW PDN DEACT %d", &cid) == 1) {

+            act = FALSE;

+        } else if (sscanf(s, "+CGEV: ME PDN DEACT %d", &cid) == 1) {

+            act = FALSE;

+        } else if(sscanf(s, "+CGEV: ME PDN ACT %d,%d", &cid, &reason) == 2

+                || sscanf(s, "+CGEV: ME PDN ACT %d", &cid) == 1) {

+            act = TRUE;

+        } else if (!strcmp(s, "+CGEV: ME DETACH")) {

+            if(cgact_wait.waitting) {

+                cid = cgact_wait.cid;

+            }

+            act = FALSE;

+        } else if (sscanf(s, "+CGEV: NW MODIFY %d,%d", &cid, &reason) == 2) {

+            act = TRUE;

+        } else if(sscanf(s, "+CGEV: EPS PDN ACT %d", &cid) == 1) {

+            act = TRUE;

+        } else {

+            LOGD(">>>>>>>>>No process +CGEV <<<<<<<<<");

+            return;

+        }

+

+        if(cgact_wait.act) {

+            if(cgact_wait.waitting && act && cgact_wait.cid == cid) {

+                cgact_wait.waitting = false;

+            }

+        } else {

+            if(cgact_wait.waitting && !act && cgact_wait.cid == cid) {

+                cgact_wait.waitting = false;

+            }

+        }

+

+        LOGD("+CGEV:cid - %d, act - %d, reason - %d", cid, act, reason);

+#else

+        if(at_process) {

+            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;

+                    char* tmp_s = memdup(s + 18,strlen(s + 18));

+                    char* free_ptr = tmp_s;

+                    char *line = tmp_s;

+                    int tmp_int;

+                    if (at_tok_start(&line) < 0)

+                    {

+                        goto at_PDP_CREG_EXIT;

+                    }

+                    if (at_tok_nextint(&line, &tmp_int) < 0)

+                    {

+                        goto at_PDP_CREG_EXIT;

+                    }

+                    if (at_tok_nextint(&line, &tmp_int) < 0)

+                    {

+                        goto at_PDP_CREG_EXIT;

+                    }

+                    data_pdp = tmp_int;

+at_PDP_CREG_EXIT:

+                    free(free_ptr);

+

+                    //data_pdp = (uint8)atoi(s + 20);  //reason

+                    if(cgact_wait.cid >= 1 && cgact_wait.cid < 8)

+                    {

+                        if(data_pdp == 0)

+                        {

+                            data_pdp = 25;

+                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                            //data_pdp = cgact_wait.cid + 200;

+                        }

+                        else if(data_pdp == 1)

+                        {

+                            data_pdp = 26;

+                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                        }

+                        else if(data_pdp == 2)

+                        {

+                            data_pdp = 27;

+                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                        }

+                        else if(data_pdp == 3)

+                        {

+                            data_pdp = 27;

+                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                        }

+                        else

+                        {

+

+                        }

+                        if(cgact_wait.cid != 0)

+                        {

+                            data_pdp = cgact_wait.cid + 200;

+                            urc_msg_distribute(false, 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;

+                    }

+                }

+            } else {

+                if(strStartsWith(s, "+CGEV: ME PDN DEACT ")) { // +CGEV: ME PDN DEACT 1

+                    if(cgact_wait.cid == atoi(s + 20)) {

+                        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)

+                    {

+                        data_pdp = cgact_wait.cid + 100;

+                        urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                    }

+                }

+            }

+        } else {

+            // apn_state_set

+

+            // +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);

+

+                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;

+                char* tmp_s = memdup(s + 18,strlen(s + 18));

+                char* free_ptr = tmp_s;

+                char *line = tmp_s;

+                int tmp_int;

+                if (at_tok_start(&line) < 0)

+                {

+                    goto PDP_CREG_EXIT;

+                }

+                if (at_tok_nextint(&line, &tmp_int) < 0)

+                {

+                    goto PDP_CREG_EXIT;

+                }

+                if (at_tok_nextint(&line, &tmp_int) < 0)

+                {

+                    goto PDP_CREG_EXIT;

+                }

+                data_pdp = tmp_int;

+PDP_CREG_EXIT:

+                free(free_ptr);

+                //data_pdp = (uint8)atoi(s + 20);  //reason

+                if(data[1] >= 1 && data[1] < 8)

+                {

+                    if(data_pdp == 0)

+                    {

+                        data_pdp = 25;

+                        urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                    }

+                    else if(data_pdp == 1)

+                    {

+                        data_pdp = 26;

+                        urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                    }

+                    else if(data_pdp == 2)

+                    {

+                        data_pdp = 27;

+                        urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                    }

+                    else if(data_pdp == 3)

+                    {

+                        data_pdp = 27;

+                        urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+                    }

+                    else

+                    {

+

+                    }

+

+                    data_pdp = data[1] + 200;

+                    urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

+					data[1] = 0;

+                }

+            } else {

+                LOGI("No process : %s", s);

+            }

+

+			urc_msg_distribute(true, INFO_URC_MSG_CGEV, data, sizeof(uint8) * 2);

+        }

+#endif

+    } else {

+        LOGW("Unknown PDP URC : %s", s);

+    }

+}

+

+

+static void urc_cell_info_process(const char *s, const char *sms_pdu)

 {

     /*

     // <mcc>, <length of mnc>, <mnc>, <tac>, <PCI>, <dlEuarfcn>, < ulEuarfcn >, <band>, <dlBandwidth>,

@@ -925,6 +1216,15 @@
     if (strStartsWith(s, "MBTK_AT_READY")) // AT ready.

     {

 

+    } else if(strStartsWith(s, "CONNECT") || strStartsWith(s, "+CGEV:")) {

+        urc_pdp_state_process(s, sms_pdu);

+    } else if(strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")

+        || strStartsWith(s, "+EEMLTEINTRA:") || strStartsWith(s, "+EEMLTEINTERRAT:")

+        || strStartsWith(s, "+EEMUMTSSVC:") || strStartsWith(s, "+EEMUMTSINTRA:")

+        || strStartsWith(s, "+EEMUMTSINTERRAT:") || strStartsWith(s, "+EEMGINFOBASIC:")

+        || strStartsWith(s, "+EEMGINFOSVC:") || strStartsWith(s, "+EEMGINFOPS:")

+        || strStartsWith(s, "+EEMGINFONC:")) {

+        urc_cell_info_process(s, sms_pdu);

     }

 #if 0

     else if(strStartsWith(s, "*RADIOPOWER:")) // "*RADIOPOWER: 1"

@@ -946,119 +1246,7 @@
         }

         urc_msg_distribute(true, INFO_URC_MSG_RADIO_STATE, &state, sizeof(uint8));

     }

-    // "CONNECT"

-    else if(strStartsWith(s, "CONNECT"))

-    {

-        if(cgact_wait.waitting && cgact_wait.act) {

-            cgact_wait.waitting = false;

-        }

-

-        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>

-    // +CGEV: ME DEACT <cid>,<cid>

-    // +CGEV: NW PDN DEACT <cid>

-    // +CGEV: ME PDN DEACT <cid>

-    // +CGEV: NW DETACH

-    // +CGEV: ME DETACH

-    //

-    // +CGEV: NW ACT <cid>,<cid>

-    // +CGEV: ME ACT <cid>,<cid>

-    // +CGEV: EPS PDN ACT <cid>

-    // +CGEV: ME PDN ACT <cid>,<reason>,<cid>

-    // +CGEV: ME PDN ACT <cid>,<reason>

-    // +CGEV: NW PDN ACT <cid>

-    // +CGEV: EPS ACT <cid>

-    // +CGEV: NW MODIFY <cid>,<reason>

-    // +CGEV: NW REATTACH

-    else if(strStartsWith(s, "+CGEV:"))

-    {

-        if(at_process) {

-            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;

-                    char* tmp_s = memdup(s + 18,strlen(s + 18));

-                    char* free_ptr = tmp_s;

-                    char *line = tmp_s;

-                    int tmp_int;

-                    if (at_tok_start(&line) < 0)

-                    {

-                        goto at_PDP_CREG_EXIT;

-                    }

-                    if (at_tok_nextint(&line, &tmp_int) < 0)

-                    {

-                        goto at_PDP_CREG_EXIT;

-                    }

-                    if (at_tok_nextint(&line, &tmp_int) < 0)

-                    {

-                        goto at_PDP_CREG_EXIT;

-                    }

-                    data_pdp = tmp_int;

-at_PDP_CREG_EXIT:

-                    free(free_ptr);

-

-                    //data_pdp = (uint8)atoi(s + 20);  //reason

-                    if(cgact_wait.cid >= 1 && cgact_wait.cid < 8)

-                    {

-                        if(data_pdp == 0)

-                        {

-                            data_pdp = 25;

-                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

-                            //data_pdp = cgact_wait.cid + 200;

-                        }

-                        else if(data_pdp == 1)

-                        {

-                            data_pdp = 26;

-                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

-                        }

-                        else if(data_pdp == 2)

-                        {

-                            data_pdp = 27;

-                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

-                        }

-                        else if(data_pdp == 3)

-                        {

-                            data_pdp = 27;

-                            urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

-                        }

-                        else

-                        {

-

-                        }

-                        if(cgact_wait.cid != 0)

-                        {

-                            data_pdp = cgact_wait.cid + 200;

-                            urc_msg_distribute(false, 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;

-                    }

-                }

-            } else {

-                if(strStartsWith(s, "+CGEV: ME PDN DEACT ")) { // +CGEV: ME PDN DEACT 1

-                    if(cgact_wait.cid == atoi(s + 20)) {

-                        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)

-                    {

-                        data_pdp = cgact_wait.cid + 100;

-                        urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));

-                    }

-                }

-            }

-        } else {

+    else {

             // apn_state_set

 

             // +CGEV: NW PDN DEACT <cid>

@@ -1581,14 +1769,6 @@
 #endif

 

 #endif

-    else if(strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")

-        || strStartsWith(s, "+EEMLTEINTRA:") || strStartsWith(s, "+EEMLTEINTERRAT:")

-        || strStartsWith(s, "+EEMUMTSSVC:") || strStartsWith(s, "+EEMUMTSINTRA:")

-        || strStartsWith(s, "+EEMUMTSINTERRAT:") || strStartsWith(s, "+EEMGINFOBASIC:")

-        || strStartsWith(s, "+EEMGINFOSVC:") || strStartsWith(s, "+EEMGINFOPS:")

-        || strStartsWith(s, "+EEMGINFONC:")) {

-        urc_cell_process(s, sms_pdu);

-    }

     else if(strStartsWith(s, "+ZGIPDNS:")) // +ZGIPDNS: 1,"IPV4V6","10.156.239.245","10.156.239.246","223.87.253.100","223.87.253.253","fe80:0000:0000:0000:0001:0001:9b8c:7c0c","fe80::1:1:9b8c:7c0d","2409:8062:2000:2::1","2409:8062:2000:2::2"

     {

 

@@ -2151,11 +2331,12 @@
     return -1;
 }

 

-

 int main(int argc, char *argv[])

 {

     mbtk_log_init("radio", "MBTK_RIL");

 

+    MBTK_SOURCE_INFO_PRINT("mbtk_rild");

+

 #ifdef MBTK_DUMP_SUPPORT

     mbtk_debug_open(NULL, TRUE);

 #endif