[Feature][L805-13] lynq_set_default_sim_except_data and lynq_get_default_sim for DSDS
Only Configure:No
Affected branch:DSDS
Affected module:SIM
Is it affected on both ZXIC and MTK: MTK
Self-test: Yes
Doc Update:Need
Change-Id: I863d9c6cf69b8e36a8980b178cac8e1dbbb77237
diff --git a/common_src/lib/liblynq-sim/src/lynq_sim.cpp b/common_src/lib/liblynq-sim/src/lynq_sim.cpp
index cbc8459..97a9292 100755
--- a/common_src/lib/liblynq-sim/src/lynq_sim.cpp
+++ b/common_src/lib/liblynq-sim/src/lynq_sim.cpp
@@ -187,9 +187,24 @@
recv_num = recvfrom(sock_fd,res_data,sizeof(char)*MAX_LEN, 0, (struct sockaddr *)&addr_serv,(socklen_t*)&len_addr_serv);
if(recv_num <= 0)
{
+ #ifdef MODE_DSDS
+ if (errno == EAGAIN || errno == EWOULDBLOCK)
+ {
+ RLOGD("recv from timeout");
+ pthread_mutex_unlock(&g_lynq_sim_sendto_mutex);
+ return LYNQ_E_TIME_OUT;
+ }
+ else
+ {
+ RLOGD("recv request fail, recv num is %d", recv_num);
+ pthread_mutex_unlock(&g_lynq_sim_sendto_mutex);
+ return recv_num;
+ }
+ #else
RLOGD("recv request fail, recv num is %d", recv_num);
pthread_mutex_unlock(&g_lynq_sim_sendto_mutex);
return recv_num;
+ #endif
}
p->setData((uint8_t *)res_data,sizeof(char)*recv_num);
p->setDataPosition(0);
@@ -279,7 +294,7 @@
return -1;
}
-#ifdef DMODE_DSDS
+ #ifdef MODE_DSDS
lynq_close_all_urc_socket_thread();
#endif
g_lynq_sim_init_flag = 0;
@@ -684,6 +699,69 @@
LYERRLOG("sim allow data value %d",s_sim_allow_data_value);
return s_sim_allow_data_value;
}
+
+
+int lynq_set_default_sim_except_data(const int slot)
+{
+ RLOGD("Enter %s",__FUNCTION__);
+
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
+
+ RLOGD("Slot is %d",slot);
+
+ if(!judge(slot))
+ {
+ RLOGD("is not 0 or 1");
+ return -1;
+ }
+
+ int send_num = 0;
+ Parcel p;
+ RLOGD(
+"send LYNQ_REQUEST_SET_DEFAULT_SIM_ALL_EXCEPT_DATA");
+ int res = lynq_send_common_request(&p,LYNQ_REQUEST_SET_DEFAULT_SIM_ALL_EXCEPT_DATA,1,1,"%d",slot);
+ if(res != 0)
+ {
+ RLOGD("function %s execute error", __FUNCTION__);
+ return res;
+ }
+
+ return 0;
+}
+
+
+
+int lynq_get_default_sim_all(int *bit_slot)
+{
+ RLOGD("Enter %s",__FUNCTION__);
+
+ int sim_except_data = 0;
+ int sim_data = 0;
+
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
+
+ int send_num = 0;
+ Parcel p;
+
+ RLOGD(
+"send LYNQ_REQUEST_GET_DEFAULT_SIM_ALL");
+ int res = lynq_send_common_request(&p,LYNQ_REQUEST_GET_DEFAULT_SIM_ALL,0,1,"");
+ if(res != 0)
+ {
+ RLOGD("function %s execute error", __FUNCTION__);
+ return res;
+ }
+
+ p.readInt32(bit_slot);
+ return 0;
+}
+
#endif
int lynq_switch_card(int slot){