T108 sim Voie data network sms 支持双卡 ql 接口第一版
Change-Id: If5a9fb81971258bb5a3d811f3e4562b2df351853
diff --git a/mbtk/include/ql_v2/ql_data_call.h b/mbtk/include/ql_v2/ql_data_call.h
index 978516b..e8eba55 100755
--- a/mbtk/include/ql_v2/ql_data_call.h
+++ b/mbtk/include/ql_v2/ql_data_call.h
@@ -33,6 +33,13 @@
typedef void ql_data_call_param_t;
+typedef enum
+{
+ QL_SIM_SLOT_INVALID = 0x000, /**< Invalid slot. */
+ QL_SIM_SLOT_1 = 0xB01, /**< Identify card in slot 1. */
+ QL_SIM_SLOT_2 = 0xB02, /**< Identify card in slot 2. */
+} QL_SIM_SLOT_E;
+
typedef struct
{
int call_id;
@@ -520,6 +527,21 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_data_call_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief chose sim card to data call
+ @param[in] sub Subscription type.
+ @return Whether the subscription was successfully bound.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_set_data_slot(QL_SIM_SLOT_E log_slot);
+
#ifdef __cplusplus
}
#endif
diff --git a/mbtk/include/ql_v2/ql_nw.h b/mbtk/include/ql_v2/ql_nw.h
index d0504e0..7b6590a 100755
--- a/mbtk/include/ql_v2/ql_nw.h
+++ b/mbtk/include/ql_v2/ql_nw.h
@@ -62,6 +62,13 @@
#define QL_NW_MAX_WEA_ALERT_LENGTH_V01 512
#define QL_NW_MAX_ETWS_ALERT_LENGTH_V01 256
+typedef enum
+{
+ QL_SIM_SLOT_INVALID = 0x000, /**< Invalid slot. */
+ QL_SIM_SLOT_1 = 0xB01, /**< Identify card in slot 1. */
+ QL_SIM_SLOT_2 = 0xB02, /**< Identify card in slot 2. */
+} QL_SIM_SLOT_E;
+
typedef enum QL_NW_SIGNAL_STRENGTH_LEVEL_ENUM
{
QL_NW_SIGNAL_STRENGTH_LEVEL_MIN = -1,
@@ -878,6 +885,20 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_nw_set_service_error_cb(ql_nw_service_error_cb_f cb);
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief chose sim card to nw
+ @param[in] sub Subscription type.
+ @return Whether the subscription was successfully bound.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_set_nw_slot(QL_SIM_SLOT_E log_slot);
+
#ifdef __cplusplus
}
#endif
diff --git a/mbtk/include/ql_v2/ql_sms.h b/mbtk/include/ql_v2/ql_sms.h
index df12ba8..529c0ac 100755
--- a/mbtk/include/ql_v2/ql_sms.h
+++ b/mbtk/include/ql_v2/ql_sms.h
@@ -32,6 +32,13 @@
#define QL_SMS_MAX_RECV_MSG_LENGTH 160 /**< Maximum length of an recv SMS. */
#define QL_SMS_MAX_ADDR_LENGTH 252 /**< Maximum length of SCA addr. */
+typedef enum
+{
+ QL_SIM_SLOT_INVALID = 0x000, /**< Invalid slot. */
+ QL_SIM_SLOT_1 = 0xB01, /**< Identify card in slot 1. */
+ QL_SIM_SLOT_2 = 0xB02, /**< Identify card in slot 2. */
+} QL_SIM_SLOT_E;
+
/** The SMS message format. */
typedef enum
{
@@ -273,4 +280,18 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_sms_bind_subscription(QL_SMS_SUBSCRIPTION_E sub);
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief chose sim card to send sms
+ @param[in] sub Subscription type.
+ @return Whether the subscription was successfully bound.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_set_sms_slot(QL_SIM_SLOT_E log_slot);
+
diff --git a/mbtk/include/ql_v2/ql_voice.h b/mbtk/include/ql_v2/ql_voice.h
index 0882a66..909d8e9 100755
--- a/mbtk/include/ql_v2/ql_voice.h
+++ b/mbtk/include/ql_v2/ql_voice.h
@@ -38,6 +38,13 @@
typedef enum
{
+ QL_SIM_SLOT_INVALID = 0x000, /**< Invalid slot. */
+ QL_SIM_SLOT_1 = 0xB01, /**< Identify card in slot 1. */
+ QL_SIM_SLOT_2 = 0xB02, /**< Identify card in slot 2. */
+} QL_SIM_SLOT_E;
+
+typedef enum
+{
QL_VOICE_STATE_INCOMING = 0x0000, /**< Call is incoming. */
QL_VOICE_STATE_DIALING = 0x0001, /**< Dialing state. */
QL_VOICE_STATE_ALERTING = 0x0002, /**< Alterting. */
@@ -1067,3 +1074,18 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_voice_bind_subscription(QL_VOICE_SUBSCRIPTION_E sub);
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief chose sim card to voice
+ @param[in] sub Subscription type.
+ @return Whether the subscription was successfully bound.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_set_voice_slot(QL_SIM_SLOT_E log_slot);
+
+
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);
diff --git a/mbtk/test/libql_lib_v2/ql_data_call_test.c b/mbtk/test/libql_lib_v2/ql_data_call_test.c
index 240ef45..fbcd5d8 100755
--- a/mbtk/test/libql_lib_v2/ql_data_call_test.c
+++ b/mbtk/test/libql_lib_v2/ql_data_call_test.c
@@ -305,7 +305,7 @@
ql_data_call_param_set_ip_version(pcfg, dat);
}
- printf("Please input reconnect_mode [0-disable,1-normal,2-mode1,3-mode2] :");
+ printf("Please input reconnect_mode [0-disable,1-normal,2-mode1,3-mode2] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -326,7 +326,7 @@
}
- printf("Please input interval_list [split by ,.:] :");
+ printf("Please input interval_list [split by ,.:] :\n");
dat_len = sizeof(dat_buf)/sizeof(dat_buf[0]);
ret = t_get_int_list(dat_buf, &dat_len);
if(ret < 0)
@@ -624,7 +624,7 @@
return;
}
- printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :");
+ printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -643,7 +643,7 @@
cfg.auth_pref = dat;
}
- printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :");
+ printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -737,6 +737,42 @@
}
}
+void item_ql_set_data_slot(void)
+{
+ int choice = -1;
+ printf("1:sim card 1, 2:sim card 2\n");
+ while (1)
+ {
+ if (scanf("%d", &choice) == 1)
+ {
+ if (choice == 1 || choice == 2)
+ {
+ break;
+ }
+ else
+ {
+ printf("invlid input \n");
+ }
+ }
+ else
+ {
+ int c;
+ while ((c = getchar()) != '\n' && c != EOF);
+ printf("invalid input \n");
+ }
+
+ }
+ if (choice == 1)
+ {
+ ql_set_sms_slot(QL_SIM_SLOT_1);
+ }
+ else if (choice == 2)
+ {
+ ql_set_sms_slot(QL_SIM_SLOT_2);
+ }
+
+}
+
#if 0
void item_ql_nslookup(void)
{
@@ -818,7 +854,7 @@
ql_data_call_apn_config_t cfg = {0};
printf("Start to item_ql_data_call_set_attach_apn_config,apn id is 1\n");
- printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :");
+ printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -837,7 +873,7 @@
cfg.auth_pref = dat;
}
- printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :");
+ printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -910,7 +946,8 @@
{"ql_data_call_set_service_error_cb", item_ql_data_call_set_service_error_cb},
{"ql_data_call_deinit", item_ql_data_call_deinit},
// {"ql_nslookup",item_ql_nslookup},
- {"ql_data_call_set_attach_apn_config", item_ql_data_call_set_attach_apn_config}
+ {"ql_data_call_set_attach_apn_config", item_ql_data_call_set_attach_apn_config},
+ {"ql_set_data_slot", item_ql_set_data_slot}
};
static void help()
diff --git a/mbtk/test/libql_lib_v2/ql_nw_test.c b/mbtk/test/libql_lib_v2/ql_nw_test.c
index 409a966..15b4bc0 100755
--- a/mbtk/test/libql_lib_v2/ql_nw_test.c
+++ b/mbtk/test/libql_lib_v2/ql_nw_test.c
@@ -1400,6 +1400,8 @@
return;
}
+
+
#if 0
void item_ql_nw_wea_set_config(void)
{
@@ -1606,6 +1608,59 @@
printf("Sucessful\n");
}
}
+void item_ql_set_nw_slot(void)
+{
+ int choice = -1;
+ int ret = -1;
+ printf("1:sim card 1, 2:sim card 2\n");
+ while (1)
+ {
+ if (scanf("%d", &choice) == 1)
+ {
+ if (choice == 1 || choice == 2)
+ {
+ break;
+ }
+ else
+ {
+ printf("invlid input \n");
+ }
+ }
+ else
+ {
+ int c;
+ while ((c = getchar()) != '\n' && c != EOF);
+ printf("invalid input \n");
+ }
+
+ }
+
+ if (choice == 1)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_1);
+ if(ret != QL_ERR_OK)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success\n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_2);
+ if(ret != QL_ERR_OK)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success\n");
+ }
+ }
+
+}
static t_item_t ql_nw_items[] =
@@ -1635,6 +1690,7 @@
// {"ql_nw_etws_set_config", item_ql_nw_etws_set_config},
// {"ql_nw_etws_get_config", item_ql_nw_etws_get_config},
{"ql_nw_set_service_error_cb", item_ql_nw_set_service_error_cb},
+ {"ql_set_nw_slot", item_ql_set_nw_slot},
{"ql_nw_deinit", item_ql_nw_deinit},
};
diff --git a/mbtk/test/libql_lib_v2/ql_sim_test.c b/mbtk/test/libql_lib_v2/ql_sim_test.c
index f71d93e..6cb4787 100755
--- a/mbtk/test/libql_lib_v2/ql_sim_test.c
+++ b/mbtk/test/libql_lib_v2/ql_sim_test.c
@@ -70,7 +70,7 @@
QL_SIM_APP_TYPE_E app_type;
printf("test ql_sim_get_imsi: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -128,7 +128,7 @@
QL_SIM_SLOT_E slot;
printf("test ql_sim_get_iccid: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -156,6 +156,7 @@
}
}
+
static void item_ql_sim_get_phone_num(void)
{
int ret = 0;
@@ -165,7 +166,7 @@
QL_SIM_APP_TYPE_E app_type;
printf("test ql_sim_get_phone_num: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -182,7 +183,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -203,7 +204,7 @@
printf("bad app type: %d\n", input);
return;
}
-
+
ret = ql_sim_get_phone_num(slot, app_type, num, sizeof(num));
if (ret == QL_ERR_OK)
{
@@ -288,7 +289,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_enable_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -393,7 +394,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_disable_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -410,7 +411,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -432,7 +433,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -449,7 +450,7 @@
return;
}
- printf("please enter pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(pin_value, sizeof(pin_value), stdin))
{
printf("can not read pin value\n");
@@ -463,7 +464,7 @@
}
printf("pin value: %s\n", pin_value);
- printf("proceed? [y/n]: ");
+ printf("proceed? [y/n]: \n");
c = getchar();
if ('\n' != c)
{
@@ -498,7 +499,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_verify_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -515,7 +516,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -537,7 +538,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -554,7 +555,7 @@
return;
}
- printf("please enter pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(pin_value, sizeof(pin_value), stdin))
{
printf("can not read pin value\n");
@@ -568,7 +569,7 @@
}
printf("pin value: %s\n", pin_value);
- printf("proceed? [y/n]: ");
+ printf("proceed? [y/n]: \n");
c = getchar();
if ('\n' != c)
{
@@ -605,7 +606,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_change_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -622,7 +623,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -644,7 +645,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -661,7 +662,7 @@
return;
}
- printf("please enter old pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter old pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(old_pin_value, sizeof(old_pin_value), stdin))
{
printf("can not read old pin value\n");
@@ -674,7 +675,7 @@
old_len--;
}
- printf("please enter new pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter new pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(new_pin_value, sizeof(new_pin_value), stdin))
{
printf("can not read new pin value\n");
@@ -743,7 +744,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -765,7 +766,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -782,7 +783,7 @@
return;
}
- printf("please enter puk value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter puk value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(puk_value, sizeof(puk_value), stdin))
{
printf("can not read old pin value\n");
@@ -795,7 +796,7 @@
len--;
}
- printf("please enter new pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter new pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(new_pin_value, sizeof(new_pin_value), stdin))
{
printf("can not read new pin value\n");
diff --git a/mbtk/test/libql_lib_v2/ql_sms_test.c b/mbtk/test/libql_lib_v2/ql_sms_test.c
index 1ebdde2..e4ecaf9 100755
--- a/mbtk/test/libql_lib_v2/ql_sms_test.c
+++ b/mbtk/test/libql_lib_v2/ql_sms_test.c
@@ -30,7 +30,7 @@
int main(int argc, char *argv[])
{
- char operator[10];
+ //char operator[10];
int opt;
int ret;
// int sms;
@@ -47,15 +47,12 @@
"\t3 sms set msg recv cb\n"
"\t4 sms set ser error cb\n"
"\t5 sms send msg async\n"
+ "\t6 sms set slot to send msg\n"
"operator: >> \n");
while(1)
{
- memset(operator, 0, sizeof(operator));
- if(NULL == fgets(operator, sizeof(operator), stdin))
- break;
- fflush(stdin);
- opt = atoi(operator);
+ scanf("%d",&opt);
switch (opt)
{
case 0:
@@ -149,7 +146,60 @@
}
}
break;
-
+ case 6:
+ {
+ int ret = -1;
+ int choice = -1;
+ printf("1:sim card 1, 2:sim card 2\n");
+ while (1)
+ {
+ if (scanf("%d", &choice) == 1)
+ {
+ if (choice == 1 || choice == 2)
+ {
+ break;
+ }
+ else
+ {
+ printf("invlid input \n");
+ }
+ }
+ else
+ {
+
+ int c;
+ while ((c = getchar()) != '\n' && c != EOF);
+ printf("invalid input \n");
+ }
+
+ }
+
+ if (choice == 1)
+ {
+ ret=ql_set_sms_slot(QL_SIM_SLOT_1);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_2);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ break;
+ }
default:
break;
diff --git a/mbtk/test/libql_lib_v2/ql_voice_test.c b/mbtk/test/libql_lib_v2/ql_voice_test.c
index 61a6cc3..132e7ea 100755
--- a/mbtk/test/libql_lib_v2/ql_voice_test.c
+++ b/mbtk/test/libql_lib_v2/ql_voice_test.c
@@ -30,7 +30,7 @@
int main(int argc, char *argv[])
{
- char operator[10];
+
int opt;
int ret;
int voice;
@@ -51,14 +51,12 @@
"\t7 voice answer\n"
"\t8 voice get records\n"
"\t9 voice send dtmf char\n"
+ "\t10 voice set sim card\n"
"operator: >> \n");
while(1)
{
- memset(operator, 0, sizeof(operator));
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- opt = atoi(operator);
+ scanf("%d",&opt);
switch (opt)
{
case 0:
@@ -132,7 +130,10 @@
printf(">>>>>Input ql_voice_dial<<<<<\n");
uint32_t id = 0;
- ret = ql_voice_dial("13388257090", 11, &id);
+ char phone_num[16] = {0};
+ printf("Please input dial number\n");
+ scanf("%s",phone_num);
+ ret = ql_voice_dial(phone_num,11, &id);
printf("id:%d", id);
if(ret < 0)
{
@@ -222,9 +223,60 @@
}
}
break;
-
-
-
+
+ case 10:
+ {
+ int ret = -1;
+ int choice = -1;
+ printf("1:sim card 1, 2:sim card 2\n");
+ while (1)
+ {
+ if (scanf("%d", &choice) == 1)
+ {
+ if (choice == 1 || choice == 2)
+ {
+ break;
+ }
+ else
+ {
+ printf("invlid input \n");
+ }
+ }
+ else
+ {
+
+ int c;
+ while ((c = getchar()) != '\n' && c != EOF);
+ printf("invalid input \n");
+ }
+
+ }
+ if (choice == 1)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_1);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_2);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ break;
+ }
default:
break;
}