[FIX]:
1.Fix global variable duplication problem with other libraries

Change-Id: I17f55b028f4aeb11b44334ec85562bf139b8de2c
diff --git a/src/lynq/lib/liblynq-call/lynq_call.cpp b/src/lynq/lib/liblynq-call/lynq_call.cpp
index e1903ae..f4aec91 100755
--- a/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -65,7 +65,7 @@
 static pthread_cond_t s_incoming_call_cond = PTHREAD_COND_INITIALIZER;

 

 

-int s_urc_event_complete = 1;

+int s_call_urc_event_complete = 1;

 

 enum{

     CALL_OFF=0,

@@ -92,11 +92,11 @@
 }LYNQ_E;

 

 int lynq_call_state =CALL_OFF;

-int lynq_client_sockfd = 0;

-int Global_uToken = 0;

+int lynq_call_client_sockfd = 0;

+int Global_uToken_call = 0;

 int global_call_count =0;

 int global_call_auto_answer = 0;

-bool urc_recive_status = 1;

+bool urc_call_recive_status = 1;

 bool call_list_loop = 1;

 int isDial = 0;

 int lynqIncomingCallId = 0;

@@ -167,18 +167,18 @@
     char *remote_phoneNum = NULL;

     char *remote_name= NULL;

     char *uusData = NULL;

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 9;//RIL_REQUEST_GET_CURRENT_CALLS

     client.paramLen = 0;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     if(error == 0)

@@ -377,7 +377,7 @@
                 call_list[i].direction,call_list[i].addr,call_list[i].toa);

             }

         }
-        s_urc_event_complete = 1;

+        s_call_urc_event_complete = 1;

         if(isDial==1)

         {

             sendSignalToWaitCallStateChange();

@@ -390,11 +390,11 @@
 

 void lynqRespWatingEvent()

 {
-    if(s_urc_event_complete==1)
+    if(s_call_urc_event_complete==1)
     {
         pthread_mutex_lock(&s_urc_call_state_change_mutex);
         pthread_cond_signal(&s_urc_call_state_change_cond);
-        s_urc_event_complete = 0;
+        s_call_urc_event_complete = 0;
         pthread_mutex_unlock(&s_urc_call_state_change_mutex);
     }

     return;
@@ -416,8 +416,8 @@
         exit(1);

     }

 */

-    lynq_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);

-    if(connect(lynq_client_sockfd, (struct sockaddr *)&lynq_socket_server_addr, sizeof(lynq_socket_server_addr)) == -1)

+    lynq_call_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);

+    if(connect(lynq_call_client_sockfd, (struct sockaddr *)&lynq_socket_server_addr, sizeof(lynq_socket_server_addr)) == -1)

     {

         perror("connect error");

         return -1;

@@ -454,7 +454,7 @@
     Parcel *p = NULL;

     struct sockaddr_in dest_addr;

     LYINFLOG("thread_urc_recv in running....\n");

-    while(urc_recive_status)

+    while(urc_call_recive_status)

     {

         bzero(urc_data,LYNQ_REC_BUF);

         //get data msg

@@ -576,7 +576,8 @@
 int lynq_init_call(int uToken)

 {

     int result = 0;

-    Global_uToken = uToken;

+    Global_uToken_call = uToken;

+    call_list_loop = 1;

     LYLOGSET(LOG_INFO);

     LYLOGEINIT(USER_LOG_TAG);

     result = lynq_socket_client_start();

@@ -600,8 +601,8 @@
 }

 int lynq_deinit_call()

 {

-    close(lynq_client_sockfd);

-    urc_recive_status = 0;

+    close(lynq_call_client_sockfd);

+    urc_call_recive_status = 0;

     call_list_loop = 0;

     return 0;

 }

@@ -619,20 +620,20 @@
         LYERRLOG("Phone num is null!!!");

         return -1;

     }

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 10;//RIL_REQUEST_DIAL

     client.paramLen = 2;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     memcpy(client.param,addr,strlen(addr)+1);

     strcat(client.param," 0");

     LYERRLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     lynq_call_id = updateAddr(addr);

@@ -658,18 +659,18 @@
     int request = -1;

     int slot_id = -1;

     int error = -1;

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 40;//RIL_REQUEST_DIAL

     client.paramLen = 0;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     return error;

@@ -684,7 +685,12 @@
     int error = -1;

     int call_id = 0;

     int lynq_call_id = 0;

-    client.uToken = Global_uToken;

+    if(handle==NULL||!((*handle>=0)&&(*handle<10)))

+    {

+        LYERRLOG("[%s] illegal input!!!!",__FUNCTION__);

+        return LYNQ_E_CONFLICT;

+    }

+    client.uToken = Global_uToken_call;

     client.request = 12;//RIL_REQUEST_HUNGUP

     client.paramLen = 1;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

@@ -692,13 +698,13 @@
     call_id = lynq_call_lists[lynq_call_id].call_id;

     sprintf(client.param,"%d",call_id);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     if(error==0)

@@ -715,18 +721,18 @@
     int request = -1;

     int slot_id = -1;

     int error = -1;

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 17;//RIL_REQUEST_UDUB

     client.paramLen = 0;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     return error;

@@ -758,18 +764,18 @@
         LYERRLOG("status is null");

         return -1;

     }

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 54;//RIL_REQUEST_GET_MUTE

     client.paramLen = 0;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     p.readInt32(status);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

@@ -793,19 +799,19 @@
     int request = -1;

     int slot_id = -1;

     int error = -1;

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 53;//RIL_REQUEST_SET_MUTE

     client.paramLen = 1;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     sprintf(client.param,"%d",enable);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     return error;

@@ -823,19 +829,19 @@
         LYERRLOG("LYNQ_E_CONFLICT");

         return LYNQ_E_CONFLICT;

     }

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 24;//RIL_REQUEST_DTMF

     client.paramLen = 1;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     sprintf(client.param,"%c",callnum);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     return error;

@@ -864,19 +870,19 @@
     //    LYERRLOG("LYNQ_E_CONFLICT");

     //    return LYNQ_E_CONFLICT;

     //}

-    client.uToken = Global_uToken;

+    client.uToken = Global_uToken_call;

     client.request = 8003;//LYNQ_REQUEST_SET_DTMF_VOLUME

     client.paramLen = 1;

     bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

     sprintf(client.param,"%d",volume);

     LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s\n",client.uToken,client.request,client.paramLen,client.param);

-    if(send_request(lynq_client_sockfd,&client)==-1)

+    if(send_request(lynq_call_client_sockfd,&client)==-1)

     {

         LYERRLOG("send request fail");

         perror("[LYNQ_CALL] send request fail:");

         return -1;

     }

-    get_response(lynq_client_sockfd,p);

+    get_response(lynq_call_client_sockfd,p);

     JumpHeader(p,&resp_type,&request,&slot_id,&error);

     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);

     return 0;