[Feature] add fast call api

Change-Id: I8c7058033d02d3b69fddc33d09a3b3a1277b737e
diff --git a/src/lynq/lib/liblynq-call/lynq_call.cpp b/src/lynq/lib/liblynq-call/lynq_call.cpp
index 174038f..dfacdde 100755
--- a/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -681,7 +681,272 @@
         LYDBGLOG("pthread join ret = %d",ret);

         return 0;

     }

+#ifdef ECALL_SUPPORT

+int lynq_fast_ecall(int* handle, int ecall_cat, int ecall_variant,  char *addr, unsigned char *msd_data)

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+    if(addr==NULL)

+    {

+        LYERRLOG("Phone num is null!!!");

+        return -1;

+    }

+    client.uToken = Global_uToken_call;

+    client.request = 9010;

+    client.paramLen = 5;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

+    sprintf(client.param,"%d %d %s %s", ecall_cat, ecall_variant, addr, msd_data);

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd, p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+    

+    lynq_call_id = updateAddr(addr);

+    if(error==0)

+    {

+        isDial = 1;

+        if(waitCallstateChange(3000)==ETIMEDOUT)//3000ms

+        {

+            error = LYNQ_E_TIME_OUT;

+            LYERRLOG("timeout:wait Call state fail!!!");

+            lynq_call_lists[lynq_call_id].hasTimeout = 1;

+            return error;

+        }

+ 

+        *handle = lynq_call_id;

+    }

+

+    return error;

 }

+

+int lynq_set_psap(int enable)

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9005;

+    client.paramLen = 2;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

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

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+

+

+int lynq_psap_pull_msd()

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9008;

+    client.paramLen = 1;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+int lynq_make_ecall(int* handle, int type)

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9006;

+    client.paramLen = 2;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

+    sprintf(client.param, "%d", type);

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+

+

+int lynq_set_msd(int call_id, char *msd_data)

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9004;

+    client.paramLen = 3;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

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

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+

+int lynq_set_ivs(int enable)

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9004;

+    client.paramLen = 2;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

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

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+

+int lynq_reset_ivs()

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9012;

+    client.paramLen = 1;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+

+int lynq_ivs_push_msd()

+{

+    Parcel p;

+    lynq_client_t client;

+    int resp_type = -1;

+    int request = -1;

+    int slot_id = -1;

+    int error = -1;

+    int lynq_call_id = -1;

+    

+

+    client.uToken = Global_uToken_call;

+    client.request = 9007;

+    client.paramLen = 1;

+    bzero(client.param,LYNQ_REQUEST_PARAM_BUF);

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

+    printf("[%s-%d] uToken=%d, request=%d, paralen=%d, param=%s\n", __FUNCTION__, __LINE__, client.uToken, client.request, client.paramLen, client.param);

+

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

+    {

+        LYERRLOG("send request fail");

+        return -1;

+    }

+    

+    get_response(lynq_call_client_sockfd,p);

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

+    printf("[%s-%d] resp_type=%d,request=%d,slot_id=%d,error_code=%d", __FUNCTION__, __LINE__, resp_type, request, slot_id, error);

+

+    return error;

+}

+#endif

 int lynq_call(int* handle,char addr[])

 {

     Parcel p;