T108 sim Voie data network sms 支持双卡 ql 接口第一版
Change-Id: If5a9fb81971258bb5a3d811f3e4562b2df351853
diff --git a/mbtk/libql_lib_v2_rilv2/ql_data_call_v1.c b/mbtk/libql_lib_v2_rilv2/ql_data_call_v1.c
index 4e3c905..3fa92bd 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_data_call_v1.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_data_call_v1.c
@@ -32,6 +32,46 @@
static ql_data_call_service_error_cb_f data_call_service_error_cb = NULL;
static ql_data_call_status_ind_cb_f data_call_status_ind_cb = NULL;
+static mbtk_sim_type_enum s_data_slot = MBTK_SIM_1;
+
+static bool check_slot_valid(QL_SIM_SLOT_E slot)
+{
+ if (slot !=QL_SIM_SLOT_1 && slot != QL_SIM_SLOT_2)
+ {
+ LOGE("bad slot: %d, slot should be 1 or 2", slot);
+ return false;
+ }
+
+ return true;
+}
+
+static void ql_slot_convert_to_mbtk(QL_SIM_SLOT_E ql_slot,mbtk_sim_type_enum *mbtk_slot)
+{
+ if(ql_slot == QL_SIM_SLOT_1)
+ {
+ *mbtk_slot = MBTK_SIM_1;
+ }
+
+ if(ql_slot == QL_SIM_SLOT_2)
+ {
+ *mbtk_slot = MBTK_SIM_2;
+ }
+
+ return;
+}
+
+int ql_set_data_slot(QL_SIM_SLOT_E log_slot)
+{
+ if(!check_slot_valid(log_slot))
+ {
+ LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(log_slot,&s_data_slot);
+ LOGE("s_net_slot is %d",s_data_slot);
+ return QL_ERR_OK;
+}
+
static int call_index_get_by_call_id(int call_id)
{
int i = 0;
@@ -424,7 +464,7 @@
mbtk_log_init("radio", "QL_DATA_CALL");
- ql_ril_handle = mbtk_ril_open(MBTK_AT_PORT_DEF);
+ ql_ril_handle = mbtk_ril_open(MBTK_AT_PORT_DATA);
if(ql_ril_handle)
{
memset(&data_call_info, 0, sizeof(data_call_info));
@@ -1309,7 +1349,9 @@
return QL_ERR_UNKNOWN;
}
- int ret = data_call_state_query(data_call_info[i].param_info->apn_param->apn_id, &(data_call_info[i].call_state));
+ int ret = MBTK_RIL_ERR_SUCCESS;
+#if 0
+ ret = data_call_state_query(data_call_info[i].param_info->apn_param->apn_id, &(data_call_info[i].call_state));
if(ret) {
LOGE("data_call_state_query fail.");
data_call_info[i].call_state.call_status = QL_NET_DATA_CALL_STATUS_IDLE;
@@ -1322,6 +1364,7 @@
LOGW("call_id %d has connected.", call_id);
return QL_ERR_UNKNOWN;
}
+#endif
LOGD("Start Data Call : %d", call_id);
// data_call_info_item_print(call_id);
@@ -1357,7 +1400,7 @@
mbtk_ip_info_t rsp_info;
memset(&rsp_info, 0, sizeof(mbtk_ip_info_t));
- ret = mbtk_data_call_start(ql_ril_handle,
+ ret = mbtk_ds_data_call_start(ql_ril_handle,s_data_slot,
(mbtk_ril_cid_enum)data_call_info[i].param_info->apn_param->apn_id,
MBTK_DATA_CALL_ITEM_STATE_NON, MBTK_DATA_CALL_ITEM_STATE_NON, MBTK_DATA_CALL_ITEM_STATE_NON,
data_call_info[i].param_info->time_list, data_call_info[i].param_info->time_num,
@@ -1419,7 +1462,7 @@
return QL_ERR_UNKNOWN;
}
- int ret = mbtk_data_call_stop(ql_ril_handle, data_call_info[i].param_info->apn_param->apn_id, 15);
+ int ret = mbtk_ds_data_call_stop(ql_ril_handle,s_data_slot, data_call_info[i].param_info->apn_param->apn_id, 15);
if(ret) {
LOGE("mbtk_data_call_stop() fail.");
return QL_ERR_UNKNOWN;
@@ -1570,7 +1613,7 @@
{
return QL_ERR_UNKNOWN;
} else {
- if(mbtk_pdp_state_change_cb_reg(data_call_state_change_cb))
+ if(mbtk_ds_pdp_state_change_cb_reg(s_data_slot,data_call_state_change_cb))
{
return QL_ERR_UNKNOWN;
}
@@ -1666,18 +1709,11 @@
memcpy(apn_info.pass, p_info->password, strlen(p_info->password));
}
- mbtk_ril_err_enum ret = mbtk_apn_set(ql_ril_handle, &apn_info);
+ mbtk_ril_err_enum ret = mbtk_ds_apn_set(ql_ril_handle, s_data_slot,&apn_info);
if(ret) {
LOGE("mbtk_apn_set fail : %d", ret);
return QL_ERR_UNKNOWN;
} else {
- return QL_ERR_OK;
- }
-
- if(ret) {
- LOGE("mbtk_apn_set fail.");
- return QL_ERR_UNKNOWN;
- } else {
// Save to data_call_apn_list
int i = 0;
@@ -1711,7 +1747,6 @@
memcpy(&(data_call_info[i].param_info->apn_param->apn_info), p_info, sizeof(ql_data_call_apn_config_t));
}
-
return QL_ERR_OK;
}
}
@@ -1745,7 +1780,7 @@
mbtk_apn_info_array_t apns;
memset(&apns, 0, sizeof(mbtk_apn_info_array_t));
- int ret = mbtk_apn_get(ql_ril_handle, &apns);
+ int ret = mbtk_ds_apn_get(ql_ril_handle,s_data_slot, &apns);
if(ret) {
LOGE("mbtk_apn_get fail.");
return QL_ERR_UNKNOWN;
@@ -1857,7 +1892,7 @@
{
return QL_ERR_UNKNOWN;
} else {
- if(mbtk_ril_close(MBTK_AT_PORT_DEF))
+ if(mbtk_ril_close(MBTK_AT_PORT_DATA))
{
return QL_ERR_UNKNOWN;
}
diff --git a/mbtk/libql_lib_v2_rilv2/ql_nw.c b/mbtk/libql_lib_v2_rilv2/ql_nw.c
index 8249cbd..2374f81 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_nw.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_nw.c
@@ -30,6 +30,7 @@
#include <fcntl.h>
#include "ql_nw.h"
+
#include "ql_type.h"
#include "mbtk_type.h"
#include "mbtk_ril_api.h"
@@ -77,6 +78,46 @@
ql_nw_service_error_cb_f server_cb;
}ql_nw_info_handle_t;
+static mbtk_sim_type_enum s_net_slot = MBTK_SIM_1;
+
+static bool check_slot_valid(QL_SIM_SLOT_E slot)
+{
+ if (slot !=QL_SIM_SLOT_1 && slot != QL_SIM_SLOT_2)
+ {
+ QL_NW_LOGE("bad slot: %d, slot should be 1 or 2", slot);
+ return false;
+ }
+
+ return true;
+}
+
+static void ql_slot_convert_to_mbtk(QL_SIM_SLOT_E ql_slot,mbtk_sim_type_enum *mbtk_slot)
+{
+ if(ql_slot == QL_SIM_SLOT_1)
+ {
+ *mbtk_slot = MBTK_SIM_1;
+ }
+
+ if(ql_slot == QL_SIM_SLOT_2)
+ {
+ *mbtk_slot = MBTK_SIM_2;
+ }
+ return;
+
+}
+
+int ql_set_nw_slot(QL_SIM_SLOT_E log_slot)
+{
+ if(!check_slot_valid(log_slot))
+ {
+ QL_NW_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(log_slot,&s_net_slot);
+ QL_NW_LOGE("s_net_slot is %d",s_net_slot);
+ return QL_ERR_OK;
+}
+
/*----------------------------------------------STRUCT-------------------------------------------*/
/*----------------------------------------------GLOBAL STATIC VARIABLE---------------------------*/
@@ -91,7 +132,7 @@
char mcc_mnc[MBTK_BUFF_TEMP_SIZE_8] = {0};
mbtk_net_info_t net = {0};
memset(&net, 0x0, sizeof(mbtk_net_info_t));
- ret = mbtk_net_sel_mode_get(p_handle->handle, &net);
+ ret = mbtk_ds_net_sel_mode_get(p_handle->handle,s_net_slot, &net);
if(ret != MBTK_ERR_OK)
{
QL_NW_LOGE("[%s] net sel mode get fail.[%d]", __func__, ret);
@@ -169,7 +210,7 @@
uint8 reg_state = 0;
mbtk_net_reg_info_t reg;
memset(®, 0x0, sizeof(mbtk_net_reg_info_t));
- ret = mbtk_net_reg_get(p_handle->handle, ®);
+ ret = mbtk_ds_net_reg_get(p_handle->handle,s_net_slot,®);
if(ret != MBTK_ERR_OK)
{
QL_NW_LOGE("[%s] net reg get fail.[%d]", __func__, ret);
@@ -599,19 +640,34 @@
goto error_1;
}
- int ret = mbtk_signal_state_change_cb_reg(ql_signal_state_change_cb);
+ int ret = mbtk_ds_signal_state_change_cb_reg(MBTK_SIM_1,ql_signal_state_change_cb);
if(ret != MBTK_ERR_OK)
{
QL_NW_LOGE("[%s] set nw signal cb fail.[%d]", __func__, ret);
goto error_2;
}
- ret = mbtk_net_reg_state_change_cb_reg(ql_net_state_change_cb);
+ ret = mbtk_ds_signal_state_change_cb_reg(MBTK_SIM_2,ql_signal_state_change_cb);
if(ret != MBTK_ERR_OK)
{
QL_NW_LOGE("[%s] set nw signal cb fail.[%d]", __func__, ret);
goto error_2;
}
+
+ ret = mbtk_ds_net_reg_state_change_cb_reg(MBTK_SIM_1,ql_net_state_change_cb);
+ if(ret != MBTK_ERR_OK)
+ {
+ QL_NW_LOGE("[%s] set nw signal cb fail.[%d]", __func__, ret);
+ goto error_2;
+ }
+
+ ret = mbtk_ds_net_reg_state_change_cb_reg(MBTK_SIM_2,ql_net_state_change_cb);
+ if(ret != MBTK_ERR_OK)
+ {
+ QL_NW_LOGE("[%s] set nw signal cb fail.[%d]", __func__, ret);
+ goto error_2;
+ }
+
ret = mbtk_ril_ser_state_change_cb_reg(ql_nw_server_change_cb);
if(ret != MBTK_ERR_OK)
@@ -752,12 +808,12 @@
if((lower_mode & QL_NW_LOWER_POWER_MASK_SMS) == QL_NW_LOWER_POWER_MASK_SMS)
{
- mode |= 0x4;
+ mode |= 0x7;
}
if((lower_mode & QL_NW_LOWER_POWER_MASK_VOICE) == QL_NW_LOWER_POWER_MASK_VOICE)
{
- mode |= 0x8;
+ mode |= 0x1B;
}
int ret = 0;
@@ -1536,3 +1592,6 @@
}
+
+
+
diff --git a/mbtk/libql_lib_v2_rilv2/ql_sim.c b/mbtk/libql_lib_v2_rilv2/ql_sim.c
index 7028f1c..5869ee9 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_sim.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_sim.c
@@ -81,6 +81,33 @@
/*----------------------------------------------GLOBAL STATIC VARIABLE---------------------------*/
/*----------------------------------------------SIM FUNCTION-------------------------------------*/
+
+static bool check_slot_valid(QL_SIM_SLOT_E slot)
+{
+ if (slot != QL_SIM_SLOT_1 && slot != QL_SIM_SLOT_2)
+ {
+ QL_SIM_LOGE("bad slot: %d, slot should be 1 or 2", slot);
+ return false;
+ }
+
+ return true;
+}
+
+static void ql_slot_convert_to_mbtk(QL_SIM_SLOT_E ql_slot,mbtk_sim_type_enum *mbtk_slot)
+{
+ if(ql_slot == QL_SIM_SLOT_1)
+ {
+ *mbtk_slot = MBTK_SIM_1;
+ }
+
+ if(ql_slot == QL_SIM_SLOT_2)
+ {
+ *mbtk_slot = MBTK_SIM_2;
+ }
+ return;
+
+}
+
static void ql_sim_state_change_cb(const void* data, int data_len)
{
if(data_len != sizeof(mbtk_ril_sim_state_info_t))
@@ -221,7 +248,10 @@
ql_sim_card_info_t sim_info = {0};
ql_sim_get_card_info(QL_SIM_SLOT_1, &sim_info);
info->status_cb(QL_SIM_SLOT_1, &sim_info);
+ ql_sim_get_card_info(QL_SIM_SLOT_2, &sim_info);
+ info->status_cb(QL_SIM_SLOT_2, &sim_info);
}
+
break;
}
default:
@@ -313,13 +343,20 @@
goto error_1;
}
- int ret = mbtk_sim_state_change_cb_reg(ql_sim_state_change_cb);
+ int ret = mbtk_ds_sim_state_change_cb_reg(MBTK_SIM_1,ql_sim_state_change_cb);
if(ret != MBTK_ERR_OK)
{
QL_SIM_LOGE("[%s] set sim state cb fail.[%d]", __func__, ret);
goto error_2;
}
+ ret = mbtk_ds_sim_state_change_cb_reg(MBTK_SIM_2,ql_sim_state_change_cb);
+ if(ret != MBTK_ERR_OK)
+ {
+ QL_SIM_LOGE("[%s] set sim state cb fail.[%d]", __func__, ret);
+ goto error_2;
+ }
+
ret = mbtk_ril_ser_state_change_cb_reg(ql_sim_server_change_cb);
if(ret != MBTK_ERR_OK)
{
@@ -412,9 +449,10 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_sim_get_imsi(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type, char *imsi, int imsi_len)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
+ mbtk_sim_type_enum sim_id = -1;
if(NULL == sim_handle)
{
QL_SIM_LOGE("[%s] sim handle not init.", __func__);
@@ -426,17 +464,24 @@
QL_SIM_LOGE("[%s] imsi is NULL.", __func__);
return QL_ERR_INVALID_ARG;
}
-
+
if(imsi_len < QL_SIM_IMSI_LENGTH)
{
QL_SIM_LOGE("[%s] imsi buf is too short.", __func__);
return QL_ERR_BUF_OVERFLOW;
}
-
+
+ if (!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
char temp_buff[MBTK_BUFF_TEMP_SIZE_32] = {0};
memset(imsi, 0x0, imsi_len);
memset(temp_buff, 0x0, MBTK_BUFF_TEMP_SIZE_32);
- int ret = mbtk_imsi_get(sim_handle->handle, (void *)temp_buff);
+ int ret = mbtk_ds_imsi_get(sim_handle->handle,sim_id,(void *)temp_buff);
if(ret != MBTK_ERR_OK)
{
QL_SIM_LOGE("[%s] imsi get fail.[%d]", __func__, ret);
@@ -462,7 +507,7 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_sim_get_iccid(QL_SIM_SLOT_E slot, char *iccid, int iccid_len)
{
- UNUSED(slot);
+ //UNUSED(slot);
if(NULL == sim_handle)
{
@@ -481,11 +526,17 @@
QL_SIM_LOGE("[%s] imsi buf is too short.", __func__);
return QL_ERR_BUF_OVERFLOW;
}
-
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
char temp_buff[MBTK_BUFF_TEMP_SIZE_32] = {0};
memset(iccid, 0x0, iccid_len);
memset(temp_buff, 0x0, MBTK_BUFF_TEMP_SIZE_32);
- int ret = mbtk_iccid_get(sim_handle->handle, (void *)temp_buff);
+ int ret = mbtk_ds_iccid_get(sim_handle->handle,sim_id, (void *)temp_buff);
if(ret != MBTK_ERR_OK)
{
QL_SIM_LOGE("[%s] iccid get fail.[%d]", __func__, ret);
@@ -514,7 +565,7 @@
int ql_sim_get_phone_num(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
char *phone_num, int phone_num_len)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
if(NULL == sim_handle)
@@ -535,10 +586,18 @@
return QL_ERR_BUF_OVERFLOW;
}
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
char temp_buff[MBTK_BUFF_TEMP_SIZE_128] = {0};
memset(phone_num, 0x0, phone_num_len);
memset(temp_buff, 0x0, MBTK_BUFF_TEMP_SIZE_128);
- int ret = mbtk_phone_number_get(sim_handle->handle, (void *)temp_buff);
+ int ret = mbtk_ds_phone_number_get(sim_handle->handle,sim_id, (void *)temp_buff);
if(ret != MBTK_ERR_OK)
{
QL_SIM_LOGE("[%s] phone_num get fail.[%d]", __func__, ret);
@@ -564,7 +623,7 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_sim_get_operators(QL_SIM_SLOT_E slot, ql_sim_operator_list_t *list)
{
- UNUSED(slot);
+ //UNUSED(slot);
if(NULL == sim_handle)
{
@@ -577,7 +636,13 @@
QL_SIM_LOGE("[%s] list is NULL.", __func__);
return QL_ERR_INVALID_ARG;
}
-
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
#if 0
list_node_t* operators_list = NULL;
mbtk_net_info_t* operator = NULL;
@@ -630,7 +695,7 @@
operators_list = NULL;
#else
mbtk_net_info_array_t net_list;
- mbtk_ril_err_enum err = mbtk_available_net_get(sim_handle->handle, &net_list);
+ mbtk_ril_err_enum err = mbtk_ds_available_net_get(sim_handle->handle,sim_id,&net_list);
if(err != MBTK_RIL_ERR_SUCCESS) {
LOGE("Error : %d", err);
} else {
@@ -685,7 +750,7 @@
int ql_sim_enable_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
QL_SIM_PIN_E pin, const char *pin_value)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
UNUSED(pin);
@@ -713,11 +778,18 @@
return QL_ERR_INVALID_ARG;
}
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
mbtk_sim_lock_info_t info = {0};
info.type = MBTK_SIM_LOCK_TYPE_ENABLE;
memcpy(info.pin1, pin_value, pin_len);
- int err = mbtk_sim_lock_set(sim_handle->handle, &info);
+ int err = mbtk_ds_sim_lock_set(sim_handle->handle,sim_id, &info);
if(err)
{
QL_SIM_LOGE("[%s] enable pin fail.[%d]", __func__, err);
@@ -746,7 +818,7 @@
int ql_sim_disable_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
QL_SIM_PIN_E pin, const char *pin_value)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
UNUSED(pin);
@@ -773,12 +845,19 @@
QL_SIM_LOGE("[%s] pin length is too short.", __func__);
return QL_ERR_INVALID_ARG;
}
-
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
mbtk_sim_lock_info_t info = {0};
info.type = MBTK_SIM_LOCK_TYPE_DISABLE;
memcpy(info.pin1, pin_value, pin_len);
- int err = mbtk_sim_lock_set(sim_handle->handle, &info);
+ int err = mbtk_ds_sim_lock_set(sim_handle->handle,sim_id, &info);
if(err)
{
QL_SIM_LOGE("[%s] disenable pin fail.[%d]", __func__, err);
@@ -808,7 +887,7 @@
int ql_sim_verify_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
QL_SIM_PIN_E pin, const char *pin_value)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
UNUSED(pin);
@@ -835,12 +914,19 @@
QL_SIM_LOGE("[%s] pin length is too short.", __func__);
return QL_ERR_INVALID_ARG;
}
-
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
mbtk_sim_lock_info_t info = {0};
info.type = MBTK_SIM_LOCK_TYPE_VERIFY_PIN;
memcpy(info.pin1, pin_value, pin_len);
- int err = mbtk_sim_lock_set(sim_handle->handle, &info);
+ int err = mbtk_ds_sim_lock_set(sim_handle->handle,sim_id, &info);
if(err)
{
QL_SIM_LOGE("[%s] verify pin fail.[%d]", __func__, err);
@@ -870,7 +956,7 @@
int ql_sim_change_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
QL_SIM_PIN_E pin, const char *old_pin_value, const char *new_pin_value)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
UNUSED(pin);
@@ -898,13 +984,20 @@
QL_SIM_LOGE("[%s] pin length is too short.", __func__);
return QL_ERR_INVALID_ARG;
}
-
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
mbtk_sim_lock_info_t info = {0};
info.type = MBTK_SIM_LOCK_TYPE_CHANGE;
memcpy(info.pin1, old_pin_value, old_pin_len);
memcpy(info.pin2, new_pin_value, new_pin_len);
- int err = mbtk_sim_lock_set(sim_handle->handle, &info);
+ int err = mbtk_ds_sim_lock_set(sim_handle->handle,sim_id, &info);
if(err)
{
QL_SIM_LOGE("[%s] change pin fail.[%d]", __func__, err);
@@ -935,7 +1028,7 @@
int ql_sim_unblock_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
QL_SIM_PIN_E pin, const char *puk_value, const char *pin_value)
{
- UNUSED(slot);
+ //UNUSED(slot);
UNUSED(app_type);
UNUSED(pin);
@@ -963,13 +1056,20 @@
QL_SIM_LOGE("[%s] length is too short.", __func__);
return QL_ERR_INVALID_ARG;
}
-
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
mbtk_sim_lock_info_t info = {0};
info.type = MBTK_SIM_LOCK_TYPE_VERIFY_PUK;
memcpy(info.pin1, pin_value, pin_len);
memcpy(info.puk, puk_value, puk_len);
- int err = mbtk_sim_lock_set(sim_handle->handle, &info);
+ int err = mbtk_ds_sim_lock_set(sim_handle->handle,sim_id, &info);
if(err)
{
QL_SIM_LOGE("[%s] unblock pin fail.[%d]", __func__, err);
@@ -993,7 +1093,7 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_sim_get_card_info(QL_SIM_SLOT_E slot, ql_sim_card_info_t *p_info)
{
- UNUSED(slot);
+ //UNUSED(slot);
if(NULL == sim_handle)
{
@@ -1007,16 +1107,24 @@
return QL_ERR_INVALID_ARG;
}
+ mbtk_sim_type_enum sim_id = -1;
+ if(!check_slot_valid(slot))
+ {
+ QL_SIM_LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(slot,&sim_id);
+
mbtk_sim_state_enum sim;
- int ret = mbtk_sim_state_get(sim_handle->handle, &sim);
+ int ret = mbtk_ds_sim_state_get(sim_handle->handle,sim_id, &sim);
if(ret != MBTK_ERR_OK)
{
QL_SIM_LOGE("[%s] sim state get fail.[%d]", __func__, ret);
return QL_ERR_FAILED;
}
-
+
mbtk_sim_card_type_enum sim_card_type;
- ret = mbtk_sim_type_get(sim_handle->handle, &sim_card_type);
+ ret = mbtk_ds_sim_type_get(sim_handle->handle,sim_id, &sim_card_type);
if(ret)
{
QL_SIM_LOGE("[%s] sim type get fail.[%d]", __func__, ret);
@@ -1024,7 +1132,7 @@
}
mbtk_pin_puk_last_times_t sim_last_times = {0};
- ret = mbtk_sim_lock_retry_times_get(sim_handle->handle, &sim_last_times);
+ ret = mbtk_ds_sim_lock_retry_times_get(sim_handle->handle,sim_id, &sim_last_times);
if(ret)
{
QL_SIM_LOGE("[%s] sim pin puk times get fail.[%d]", __func__, ret);
@@ -1032,7 +1140,7 @@
}
int pin_state;
- ret = mbtk_sim_lock_get(sim_handle->handle, &pin_state);
+ ret = mbtk_ds_sim_lock_get(sim_handle->handle,sim_id, &pin_state);
if(ret)
{
QL_SIM_LOGE("[%s] sim pin state get fail.[%d]", __func__, ret);
diff --git a/mbtk/libql_lib_v2_rilv2/ql_sms.c b/mbtk/libql_lib_v2_rilv2/ql_sms.c
index 7323949..cdfa6fe 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_sms.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_sms.c
@@ -59,6 +59,46 @@
static ql_sms_info_handle_t* sms_handle = NULL;
+static mbtk_sim_type_enum s_sms_slot = MBTK_SIM_1;
+
+static bool check_slot_valid(QL_SIM_SLOT_E slot)
+{
+ if (slot !=QL_SIM_SLOT_1 && slot != QL_SIM_SLOT_2)
+ {
+ LOGE("bad slot: %d, slot should be 1 or 2", slot);
+ return false;
+ }
+
+ return true;
+}
+
+static void ql_slot_convert_to_mbtk(QL_SIM_SLOT_E ql_slot,mbtk_sim_type_enum *mbtk_slot)
+{
+ if(ql_slot == QL_SIM_SLOT_1)
+ {
+ *mbtk_slot = MBTK_SIM_1;
+ }
+
+ if(ql_slot == QL_SIM_SLOT_2)
+ {
+ *mbtk_slot = MBTK_SIM_2;
+ }
+ return;
+
+}
+
+int ql_set_sms_slot(QL_SIM_SLOT_E log_slot)
+{
+ if(!check_slot_valid(log_slot))
+ {
+ LOGE("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(log_slot,&s_sms_slot);
+ LOGE("s_net_slot is %d",s_sms_slot);
+ return QL_ERR_OK;
+}
+
static void ql_sms_state_change_cb(const void* data, int data_len)
{
LOGV("sms_state_change_cb()----------start\n");
@@ -137,7 +177,7 @@
LOGE("Minute: %d\n", sms_timestamp.minutes);
LOGE("Second: %d\n", sms_timestamp.seconds);
- if(total_pack > 1 && curr_pack < total_pack)
+ if(total_pack > 1 && curr_pack <= total_pack)
{
sms_user_data_head.valid = TRUE;
sms_user_data_head.total_seg = total_pack;
@@ -146,8 +186,8 @@
else
{
sms_user_data_head.valid = FALSE;
- sms_user_data_head.total_seg = total_pack;
- sms_user_data_head.cur_seg_num = curr_pack;
+ sms_user_data_head.total_seg = 0;
+ sms_user_data_head.cur_seg_num = 0;
}
if(sms_handle->recv_cb)
@@ -159,14 +199,10 @@
static void ql_sms_server_change_cb(const void* data, int data_len)
{
- if(data_len != sizeof(int))
+ if(data)
{
- LOGE("[ql_sms_server_change_cb] data_len[%d] than int[%d] fail. ", data_len, sizeof(int));
- }
- else
- {
- int server_state = *(int *)data;
- if(server_state == 1 && sms_handle->server_cb)
+ mbtk_ril_ser_state_enum server_state = *(mbtk_ril_ser_state_enum *)data;
+ if(sms_handle->server_cb && server_state == MBTK_RIL_SER_STATE_EXIT)
{
sms_handle->server_cb(QL_ERR_ABORTED);
}
@@ -207,14 +243,32 @@
}
}
- int err = mbtk_sms_cnmi_set(sms_handle->handle);
+ int err = mbtk_ds_sms_cnmi_set(sms_handle->handle,MBTK_SIM_1);
+ if(err)
+ {
+ LOGE("set cnmi fail");
+ return QL_ERR_FAILED;
+ }
+ err = mbtk_ds_sms_cnmi_set(sms_handle->handle,MBTK_SIM_2);
if(err)
{
LOGE("set cnmi fail");
return QL_ERR_FAILED;
}
- int ret = mbtk_sms_state_change_cb_reg( ql_sms_state_change_cb);
+ int ret = mbtk_ds_sms_state_change_cb_reg(MBTK_SIM_1,ql_sms_state_change_cb);
+ if(ret != MBTK_ERR_OK)
+ {
+ LOGE("[ql_sms_init] set sms state cb fail.[%d]", ret);
+ if(sms_handle->handle)
+ {
+ mbtk_ril_close(MBTK_AT_PORT_DEF);
+ sms_handle->handle = NULL;
+ return QL_ERR_FAILED;
+ }
+ }
+
+ ret = mbtk_ds_sms_state_change_cb_reg(MBTK_SIM_2,ql_sms_state_change_cb);
if(ret != MBTK_ERR_OK)
{
LOGE("[ql_sms_init] set sms state cb fail.[%d]", ret);
@@ -226,18 +280,18 @@
}
}
- ret = mbtk_net_reg_state_change_cb_reg(ql_sms_server_change_cb);
+ ret = mbtk_ril_ser_state_change_cb_reg(ql_sms_server_change_cb);
if(ret != MBTK_ERR_OK)
{
- LOGE("[ql_sim_init] set sim server cb fail.[%d]", ret);
- if(sms_handle->handle)
+ LOGE("[%s] mbtk_ril_ser_state_change_cb_reg fail.[%d]", __func__, ret);
+ if(sms_handle->handle)
{
mbtk_ril_close(MBTK_AT_PORT_DEF);
sms_handle->handle = NULL;
return QL_ERR_FAILED;
}
}
-
+
sms_handle->recv_cb = NULL;
sms_handle->server_cb = NULL;
}
@@ -518,7 +572,7 @@
LOGD("cmgf set success");
}
- err = mbtk_sms_cmgs_set(sms_handle->handle, cmgs, resp);
+ err = mbtk_ds_sms_cmgs_set(sms_handle->handle,s_sms_slot, cmgs, resp);
if(err)
{
LOGE("cmgs send fail (%d)",err);
@@ -658,3 +712,5 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_sms_bind_subscription(QL_SMS_SUBSCRIPTION_E sub);
+
+
diff --git a/mbtk/libql_lib_v2_rilv2/ql_voice.c b/mbtk/libql_lib_v2_rilv2/ql_voice.c
index 367753d..4ce0151 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_voice.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_voice.c
@@ -99,7 +99,7 @@
};
-
+/*
static int end_reason_mbtk_to_ql(char* mbtk_reason, int* ql_reason)
{
int bufefer_i = 0;
@@ -118,7 +118,47 @@
return 0;
}
+*/
+static mbtk_sim_type_enum s_voice_slot = MBTK_SIM_1;
+
+static bool check_slot_valid(QL_SIM_SLOT_E slot)
+{
+ if (slot !=QL_SIM_SLOT_1 && slot != QL_SIM_SLOT_2)
+ {
+ LOG("bad slot: %d, slot should be 1 or 2", slot);
+ return false;
+ }
+
+ return true;
+}
+
+static void ql_slot_convert_to_mbtk(QL_SIM_SLOT_E ql_slot,mbtk_sim_type_enum *mbtk_slot)
+{
+ if(ql_slot == QL_SIM_SLOT_1)
+ {
+ *mbtk_slot = MBTK_SIM_1;
+ }
+
+ if(ql_slot == QL_SIM_SLOT_2)
+ {
+ *mbtk_slot = MBTK_SIM_2;
+ }
+ return;
+
+}
+
+int ql_set_voice_slot(QL_SIM_SLOT_E log_slot)
+{
+ if(!check_slot_valid(log_slot))
+ {
+ LOG("[%s] check_slot_valid failed.", __func__);
+ return QL_ERR_INVALID_ARG;
+ }
+ ql_slot_convert_to_mbtk(log_slot,&s_voice_slot);
+ LOG("s_net_slot is %d",s_voice_slot);
+ return QL_ERR_OK;
+}
static void ql_voice_state_change_cb(const void* data, int data_len)
{
@@ -133,16 +173,16 @@
return;
}
- mbtk_call_info_t *reg = (mbtk_call_info_t *)data;
+ mbtk_ril_call_state_info_t *reg = (mbtk_ril_call_state_info_t *)data;
int ql_reason = 0;
- end_reason_mbtk_to_ql((char*)reg->end_reason, &ql_reason);
+ //end_reason_mbtk_to_ql((char*)reg->end_reason, &ql_reason);
LOG("ql_voice_state_change_cb ql_reason:%d", ql_reason);
if(MBTK_RIL_CALL_STATE_DISCONNECT != reg->state)
{
- LOG("ql_voice_state_change_cb : %d, %d, %d, %d, %d, %s, %d, %s", reg->dir1, reg->dir, reg->state, reg->mode, reg->mpty, reg->phone_number, reg->type, reg->end_reason);
+ LOG("ql_voice_state_change_cb : %d, %d, %d, %d, %s", reg->call_id, reg->dir, reg->state, reg->num_type, reg->call_number);
switch(reg->state)
{
@@ -167,27 +207,29 @@
case 7:
voice_handle->state_t = QL_VOICE_STATE_END;
break;
+ default:
+ break;
}
- if (voice_handle->record_array.records[0].id == 0 || voice_handle->record_array.records[0].id == reg->dir1)
+ if (voice_handle->record_array.records[0].id == 0 || voice_handle->record_array.records[0].id == reg->call_id)
{
voice_handle->record_array.len = 1;
- voice_handle->record_array.records[0].id = reg->dir1;
+ voice_handle->record_array.records[0].id = reg->call_id;
voice_handle->record_array.records[0].tech = 1;
voice_handle->record_array.records[0].dir = reg->dir;
voice_handle->record_array.records[0].end_reason = ql_reason;
voice_handle->record_array.records[0].state = voice_handle->state_t;
- memcpy(voice_handle->record_array.records[0].number, reg->phone_number, strlen(reg->phone_number));
+ memcpy(voice_handle->record_array.records[0].number, reg->call_number, strlen((char *)reg->call_number));
}
- else if (voice_handle->record_array.records[0].id != reg->dir1)
+ else if (voice_handle->record_array.records[0].id != reg->call_id)
{
voice_handle->record_array.len = 2;
- voice_handle->record_array.records[1].id = reg->dir1;
+ voice_handle->record_array.records[1].id = reg->call_id;
voice_handle->record_array.records[1].tech = 1;
voice_handle->record_array.records[1].dir = reg->dir;
voice_handle->record_array.records[1].end_reason = ql_reason;
voice_handle->record_array.records[1].state = voice_handle->state_t;
- memcpy(voice_handle->record_array.records[1].number, reg->phone_number, strlen(reg->phone_number));
+ memcpy(voice_handle->record_array.records[1].number, reg->call_number, strlen((char *)reg->call_number));
}
voice_handle->call_cb(&voice_handle->record_array);
@@ -197,18 +239,18 @@
LOGI("RING : call dis connected!");
voice_handle->record_array.records[0].end_reason = ql_reason;
voice_handle->record_array.records[1].end_reason = ql_reason;
- if(voice_handle->record_array.records[0].id == reg->dir1)
+ if(voice_handle->record_array.records[0].id == reg->call_id)
{
voice_handle->record_array.records[0].state = QL_VOICE_STATE_END;
voice_handle->record_array.records[0].id = 0;
}
- if(voice_handle->record_array.records[1].id == reg->dir1)
+ if(voice_handle->record_array.records[1].id == reg->call_id)
{
voice_handle->record_array.records[1].state = QL_VOICE_STATE_END;
voice_handle->record_array.records[1].id = 0;
voice_handle->record_array.len = 1;
}
- if (reg->disconnected_id == voice_handle->record_array.records[1].id)
+ if (reg->call_id == voice_handle->record_array.records[1].id)
voice_handle->call_cb(&voice_handle->record_array);
else
voice_handle->call_cb(&voice_handle->record_array);
@@ -218,14 +260,10 @@
static void ql_voice_server_change_cb(const void* data, int data_len)
{
- if(data_len != sizeof(int))
+ if(data)
{
- LOGE("[ql_voice_server_change_cb] data_len[%d] than int[%d] fail. ", data_len, sizeof(int));
- }
- else
- {
- int server_state = *(int *)data;
- if(server_state == 1 && voice_handle->server_cb)
+ mbtk_ril_ser_state_enum server_state = *(mbtk_ril_ser_state_enum *)data;
+ if(voice_handle->server_cb && server_state == MBTK_RIL_SER_STATE_EXIT)
{
voice_handle->server_cb(QL_ERR_ABORTED);
}
@@ -255,7 +293,7 @@
return QL_ERR_FAILED;
}
- voice_handle->handle = mbtk_ril_open(MBTK_AT_PORT_DEF);
+ voice_handle->handle = mbtk_ril_open(MBTK_AT_PORT_VOICE);
if(NULL == voice_handle->handle)
{
LOGE("[ql_voice_init] mbtk handle init fail.");
@@ -267,13 +305,24 @@
}
}
- int ret = mbtk_call_state_change_cb_reg( ql_voice_state_change_cb);
+ int ret = mbtk_ds_call_state_change_cb_reg(MBTK_SIM_1,ql_voice_state_change_cb);
if(ret != MBTK_ERR_OK)
{
LOGE("[ql_voice_init] set voice state cb fail.[%d]", ret);
if(voice_handle->handle)
{
- mbtk_ril_close(MBTK_AT_PORT_DEF);
+ mbtk_ril_close(MBTK_AT_PORT_VOICE);
+ voice_handle->handle = NULL;
+ return QL_ERR_FAILED;
+ }
+ }
+ ret = mbtk_ds_call_state_change_cb_reg(MBTK_SIM_2,ql_voice_state_change_cb);
+ if(ret != MBTK_ERR_OK)
+ {
+ LOGE("[ql_voice_init] set voice state cb fail.[%d]", ret);
+ if(voice_handle->handle)
+ {
+ mbtk_ril_close(MBTK_AT_PORT_VOICE);
voice_handle->handle = NULL;
return QL_ERR_FAILED;
}
@@ -285,7 +334,7 @@
LOGE("[ql_sim_init] set sim server cb fail.[%d]", ret);
if(voice_handle->handle)
{
- mbtk_ril_close(MBTK_AT_PORT_DEF);
+ mbtk_ril_close(MBTK_AT_PORT_VOICE);
voice_handle->handle = NULL;
return QL_ERR_FAILED;
}
@@ -320,7 +369,7 @@
if(NULL != voice_handle->handle)
{
- ret = mbtk_ril_close(MBTK_AT_PORT_DEF);
+ ret = mbtk_ril_close(MBTK_AT_PORT_VOICE);
if(ret != MBTK_ERR_OK)
{
LOGE("[ql_voice_deinit] mbtk handle deinit fail.[%d]", ret);
@@ -376,7 +425,7 @@
phone_num_t = num;
- err = mbtk_call_start(voice_handle->handle, phone_num_t);
+ err = mbtk_ds_call_start(voice_handle->handle, s_voice_slot,phone_num_t);
if(err)
{
LOGE("Error : %d\n", err);
@@ -387,7 +436,7 @@
LOGI("Call success.");
}
- mbtk_call_reg_get(voice_handle->handle, ®);
+ mbtk_ds_call_reg_get(voice_handle->handle, s_voice_slot,®);
*id = reg.dir1;
LOG("ql_voice_dial call_id: %d\n", reg.dir1, *id);
@@ -656,7 +705,7 @@
dtmf->duration = 300;
dtmf->character = callnum_c;
- ret = mbtk_dtmf_send(voice_handle->handle, dtmf);
+ ret = mbtk_ds_dtmf_send(voice_handle->handle,s_voice_slot, dtmf);
if (ret)
{
LOGE("mbtk_dtmf_send Error : %d", ret);