[Feature][L805-12] New dual card get call state and compatible with other interfaces

Only Configure:No
Affected branch:DSDS
Affected module:CALL
Is it affected on both ZXIC and MTK: NO
Self-test: Yes
Doc Update:Need

Change-Id: I755f54e0eb4e695e9e57b3a4333f19e434d6604d
diff --git a/common_src/lib/liblynq-call/include/libcall/lynq_call.h b/common_src/lib/liblynq-call/include/libcall/lynq_call.h
index 6de1251..81f0855 100755
--- a/common_src/lib/liblynq-call/include/libcall/lynq_call.h
+++ b/common_src/lib/liblynq-call/include/libcall/lynq_call.h
@@ -64,6 +64,9 @@
 int lynq_hangup_waiting_or_background(void);

 int lynq_hangup_foreground_resume_background(void);

 

+/* Add api for DSDS*/

+int lynq_get_current_call_state_ext(int *handle,int *slot,int *call_state,int *toa,int *direction,char addr[]);

+

 /*lei add for API-163/API-164 2023/1/3*/

 /**

  * @brief                  wait_call_state_change

diff --git a/common_src/lib/liblynq-call/lynq_call.cpp b/common_src/lib/liblynq-call/lynq_call.cpp
index 0b7e385..7ce1d26 100755
--- a/common_src/lib/liblynq-call/lynq_call.cpp
+++ b/common_src/lib/liblynq-call/lynq_call.cpp
@@ -90,6 +90,10 @@
 static int s_call_auto_answer = 0;

 static time_t s_rev_ring_time=0;

 

+#ifdef MODE_DSDS

+int global_slot = -1;

+#endif

+

 

 typedef enum{

     LYNQ_E_VOLUMN_SET_DTMF,

@@ -1205,6 +1209,50 @@
     return INVALID_ID;

 }

 

+#ifdef MODE_DSDS

+int lynq_get_current_call_state_ext(int *handle,    int *slot,int *call_state,int *toa,int *direction,char addr[])

+{

+    if(g_module_init_flag != MODULE_RUNNING)

+    {

+        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

+        return LYNQ_E_CONFLICT;

+    }

+    int lynq_call_id = 0;

+    LYINFLOG("lynq_get_current_call_state begin ");

+    if(handle==NULL)

+    {

+        LYERRLOG("handle is NULL");

+        return LYNQ_E_PARAMETER_ANONALY;

+    }

+    if((*handle) <= 0)

+    {

+        LYINFLOG("lynq_get_current_call_state input error %d\n ", *handle);

+        return LYNQ_E_INVALID_ID_ANONALY;

+    }

+    LYINFLOG("lynq_get_current_call_state %d\n ", *handle);

+    lynq_call_id = find_call_id_with_call_id(*handle);

+    if(lynq_call_id==INVALID_ID)

+    {

+        //find end state

+        if((*handle) >= 0)

+        {

+            *call_state = (int)LYNQ_CALL_END;

+            return RESULT_OK; 

+        }

+        else

+        {

+            return LYNQ_E_INVALID_ID_ANONALY;

+        }

+    }

+    *slot = global_slot;

+    *call_state = s_call_lists[lynq_call_id].call_state;

+    *toa = s_call_lists[lynq_call_id].toa;

+    *direction = s_call_lists[lynq_call_id].direction;

+    memcpy(addr,s_call_lists[lynq_call_id].addr,strlen(s_call_lists[lynq_call_id].addr)+1);

+    return RESULT_OK;

+}

+#endif

+

 int lynq_get_current_call_state(int *handle,    int *call_state,int *toa,int *direction,char addr[])

 {

     if(g_module_init_flag != MODULE_RUNNING)

diff --git a/common_src/lib/liblynq-call/lynq_module_socket.cpp b/common_src/lib/liblynq-call/lynq_module_socket.cpp
index b33dd68..cd63b0c 100755
--- a/common_src/lib/liblynq-call/lynq_module_socket.cpp
+++ b/common_src/lib/liblynq-call/lynq_module_socket.cpp
@@ -50,6 +50,7 @@
     int urcid;   

 }lynq_head_t;

 

+

 lynq_client_t client_t;

 lynq_resp_t response;

 

@@ -98,6 +99,10 @@
 /*inner test*/

 static int s_inner_test=0;

 

+#ifdef MODE_DSDS

+extern int global_slot;

+#endif

+

 /**@brief just for inner test

 * @param test_mode [IN]: test mode

 *  0:success

@@ -206,6 +211,10 @@
         p->readInt32(&(head.token));

         p->readInt32(&(head.request));

         p->readInt32(&(head.slot_id));

+        

+#ifdef MODE_DSDS

+        global_slot = head.slot_id;

+#endif

         p->readInt32(&(head.error));

         PrintHeader(head);

         return RESULT_OK;  

diff --git a/common_src/lib/liblynq-call/makefile b/common_src/lib/liblynq-call/makefile
index 6d3e7ba..52064c4 100755
--- a/common_src/lib/liblynq-call/makefile
+++ b/common_src/lib/liblynq-call/makefile
@@ -45,6 +45,10 @@
     LOCAL_CFLAGS += -DGSW_RIL_CFG
 endif
 
+ifeq ($(strip $(MTK_MULTI_SIM_SUPPORT)), dsds)
+    LOCAL_CFLAGS += -DMODE_DSDS
+endif
+
 SOURCES = $(wildcard *.cpp)
 
 EXECUTABLE = liblynq-call.so