Add DS support.
Change-Id: Ib8bc4e171dd5ca526f8e151ff3d467097582a8cb
diff --git a/mbtk/mbtk_rild_v2/src/ril_ecall.c b/mbtk/mbtk_rild_v2/src/ril_ecall.c
index ae8dcd7..3a13b61 100755
--- a/mbtk/mbtk_rild_v2/src/ril_ecall.c
+++ b/mbtk/mbtk_rild_v2/src/ril_ecall.c
@@ -40,9 +40,11 @@
static mbtk_ecall_mode_type_enum ecall_mode = MBTK_ECALL_MODE_TYPE_EU;
-void ril_rsp_pack_send(ATPortType_enum port, int fd, int ril_id, int msg_index, const void* data, int data_len);
+void ril_rsp_pack_send(mbtk_sim_type_enum sim_id, ATPortType_enum port, int fd, int ril_id, int msg_index, const void* data, int data_len);
+ATPortId_enum portType_2_portId(mbtk_sim_type_enum sim_id, ATPortType_enum port);
-static int cfg_ecalldata_get(ATPortType_enum port, mbtk_ecall_cfg_item_enum type, uint32 *value, int *cme_err)
+
+static int cfg_ecalldata_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_cfg_item_enum type, uint32 *value, int *cme_err)
{
ATResponse *response = NULL;
// char *tmp_ptr = NULL;
@@ -51,7 +53,7 @@
int err = 0;
snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d", type);
- err = at_send_command_singleline(port, cmd, "*ECALLDATA:", &response);
+ err = at_send_command_singleline(portType_2_portId(sim_id, port), cmd, "*ECALLDATA:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -91,14 +93,14 @@
return err;
}
-static int cfg_ecalldata_set(ATPortType_enum port, mbtk_ecall_cfg_item_enum type, uint32 value, int *cme_err)
+static int cfg_ecalldata_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_cfg_item_enum type, uint32 value, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
int err = 0;
snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d,%d", type, value / 20);
- err = at_send_command(port, cmd, &response);
+ err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -110,14 +112,14 @@
return err;
}
-static int cfg_ecalltimer_set(ATPortType_enum port, const char* type, uint32 value, int *cme_err)
+static int cfg_ecalltimer_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const char* type, uint32 value, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
int err = 0;
snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=%s,%d", type, value);
- err = at_send_command(port, cmd, &response);
+ err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -129,12 +131,12 @@
return err;
}
-static int req_ecall_msdcfg(ATPortType_enum port, mbtk_ecall_msd_cfg_info_t *cfg_info, int *cme_err)
+static int req_ecall_msdcfg(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_msd_cfg_info_t *cfg_info, int *cme_err)
{
ATResponse *response = NULL;
char cmd[1024] = {0};
sprintf(cmd, "AT*ECALLMSDCFG=%d,\"%s\",0", cfg_info->item_type, cfg_info->data);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -145,10 +147,10 @@
return err;
}
-static int req_ecall_msdgen(ATPortType_enum port, int *cme_err)
+static int req_ecall_msdgen(mbtk_sim_type_enum sim_id, ATPortType_enum port, int *cme_err)
{
ATResponse *response = NULL;
- int err = at_send_command(port, "AT*ECALLMSDGEN", &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), "AT*ECALLMSDGEN", &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -159,12 +161,12 @@
return err;
}
-static int req_ecall_msd_set(ATPortType_enum port, const uint8 *msd, int *cme_err)
+static int req_ecall_msd_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const uint8 *msd, int *cme_err)
{
ATResponse *response = NULL;
char cmd[1024] = {0};
sprintf(cmd, "AT*ECALLMSD=\"%s\"", msd);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -175,11 +177,11 @@
return err;
}
-static int req_ecall_msd_get(ATPortType_enum port, uint8 *msd, int *cme_err)
+static int req_ecall_msd_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, uint8 *msd, int *cme_err)
{
ATResponse *response = NULL;
char *tmp_ptr = NULL;
- int err = at_send_command_singleline(port, "AT*ECALLMSD?", "*ECALLMSD:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*ECALLMSD?", "*ECALLMSD:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -209,10 +211,10 @@
return err;
}
-static int req_ecall_push(ATPortType_enum port, int *cme_err)
+static int req_ecall_push(mbtk_sim_type_enum sim_id, ATPortType_enum port, int *cme_err)
{
ATResponse *response = NULL;
- int err = at_send_command(port, "AT*ECALLPUSH", &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), "AT*ECALLPUSH", &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -230,12 +232,12 @@
OK
*/
-static int req_ecall_only_get(ATPortType_enum port, mbtk_ecall_only_info_t *only_info, int *cme_err)
+static int req_ecall_only_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_only_info_t *only_info, int *cme_err)
{
ATResponse *response = NULL;
char *tmp_ptr = NULL;
int tmp_int;
- int err = at_send_command_singleline(port, "AT*ECALLONLY?", "*ECALLONLY:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*ECALLONLY?", "*ECALLONLY:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -296,12 +298,12 @@
OK
*/
-static int req_ecall_only_set(ATPortType_enum port, const mbtk_ecall_only_info_t *only_info, int *cme_err)
+static int req_ecall_only_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const mbtk_ecall_only_info_t *only_info, int *cme_err)
{
ATResponse *response = NULL;
char cmd[1024] = {0};
sprintf(cmd, "AT*ECALLONLY=%d,%s,%s", only_info->active,only_info->test_num,only_info->reconfig_num);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -316,12 +318,12 @@
AT*ECALLREG=0/1
*/
-static int req_ecall_reg_set(ATPortType_enum port, uint8 reg, int *cme_err)
+static int req_ecall_reg_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, uint8 reg, int *cme_err)
{
ATResponse *response = NULL;
char cmd[30] = {0};
sprintf(cmd, "AT*ECALLREG=%d", reg);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -339,11 +341,11 @@
OK
*/
-static int req_ecall_dial_state_get(ATPortType_enum port, mbtk_ecall_dial_type_enum *type, int *cme_err)
+static int req_ecall_dial_state_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_dial_type_enum *type, int *cme_err)
{
ATResponse *response = NULL;
int tmp_int;
- int err = at_send_command_singleline(port, "AT+CECALL?", "+CECALL:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT+CECALL?", "+CECALL:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -374,12 +376,12 @@
AT+CECALL=<ecalltype>
OK
*/
-static int req_ecall_dial_start(ATPortType_enum port, mbtk_ecall_dial_type_enum type, int *cme_err)
+static int req_ecall_dial_start(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_dial_type_enum type, int *cme_err)
{
ATResponse *response = NULL;
char cmd[1024] = {0};
sprintf(cmd, "AT+CECALL=%d", type);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -398,11 +400,11 @@
OK
*/
-static int req_ecall_mode_get(ATPortType_enum port, mbtk_ecall_mode_type_enum *mode, int *cme_err)
+static int req_ecall_mode_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_mode_type_enum *mode, int *cme_err)
{
ATResponse *response = NULL;
char *tmp_ptr = NULL;
- int err = at_send_command_singleline(port, "AT*ECALLMODE?", "*ECALLMODE:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*ECALLMODE?", "*ECALLMODE:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -445,7 +447,7 @@
OK
*/
-static int req_ecall_mode_set(ATPortType_enum port, mbtk_ecall_mode_type_enum mode, int *cme_err)
+static int req_ecall_mode_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_mode_type_enum mode, int *cme_err)
{
ATResponse *response = NULL;
char cmd[1024] = {0};
@@ -454,7 +456,7 @@
} else {
sprintf(cmd, "AT*ECALLMODE=\"ERA\"");
}
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -479,7 +481,7 @@
OK
*/
-static int req_ecall_cfg_get(ATPortType_enum port, uint32 type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
+static int req_ecall_cfg_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, uint32 type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
{
ATResponse *response = NULL;
char *tmp_ptr = NULL;
@@ -489,7 +491,7 @@
cfg->type = type;
if(type & MBTK_ECALL_CFG_T3) {
- if(cfg_ecalldata_get(port, MBTK_ECALL_CFG_ITEM_T3, &(cfg->data[MBTK_ECALL_CFG_ITEM_T3]), cme_err)
+ if(cfg_ecalldata_get(sim_id, port, MBTK_ECALL_CFG_ITEM_T3, &(cfg->data[MBTK_ECALL_CFG_ITEM_T3]), cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -498,7 +500,7 @@
}
if(type & MBTK_ECALL_CFG_T5) {
- if(cfg_ecalldata_get(port, MBTK_ECALL_CFG_ITEM_T5, &(cfg->data[MBTK_ECALL_CFG_ITEM_T5]), cme_err)
+ if(cfg_ecalldata_get(sim_id, port, MBTK_ECALL_CFG_ITEM_T5, &(cfg->data[MBTK_ECALL_CFG_ITEM_T5]), cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -507,7 +509,7 @@
}
if(type & MBTK_ECALL_CFG_T6) {
- if(cfg_ecalldata_get(port, MBTK_ECALL_CFG_ITEM_T6, &(cfg->data[MBTK_ECALL_CFG_ITEM_T6]), cme_err)
+ if(cfg_ecalldata_get(sim_id, port, MBTK_ECALL_CFG_ITEM_T6, &(cfg->data[MBTK_ECALL_CFG_ITEM_T6]), cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -516,7 +518,7 @@
}
if(type & MBTK_ECALL_CFG_T7) {
- if(cfg_ecalldata_get(port, MBTK_ECALL_CFG_ITEM_T7, &(cfg->data[MBTK_ECALL_CFG_ITEM_T7]), cme_err)
+ if(cfg_ecalldata_get(sim_id, port, MBTK_ECALL_CFG_ITEM_T7, &(cfg->data[MBTK_ECALL_CFG_ITEM_T7]), cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -525,7 +527,7 @@
}
if(type & MBTK_ECALL_CFG_TH) {
- if(cfg_ecalldata_get(port, MBTK_ECALL_CFG_ITEM_TH, &(cfg->data[MBTK_ECALL_CFG_ITEM_TH]), cme_err)
+ if(cfg_ecalldata_get(sim_id, port, MBTK_ECALL_CFG_ITEM_TH, &(cfg->data[MBTK_ECALL_CFG_ITEM_TH]), cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -536,7 +538,7 @@
if(type & (MBTK_ECALL_CFG_TIMER_CALLBACK | MBTK_ECALL_CFG_TIMER_CLEARDOWN | MBTK_ECALL_CFG_TIMER_DEREG
| MBTK_ECALL_CFG_TIMER_DIAL | MBTK_ECALL_CFG_TIMER_REDIAL | MBTK_ECALL_CFG_TIMER_SMS
| MBTK_ECALL_CFG_REDIALCNT | MBTK_ECALL_CFG_SMSPROCESS | MBTK_ECALL_CFG_SMSMSDCNT)) {
- err = at_send_command_singleline(port, "AT*ECALLTIMER?", "*ECALLTIMER:", &response);
+ err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*ECALLTIMER?", "*ECALLTIMER:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -653,7 +655,7 @@
AT*ECALLTIMER=dereg,300
OK
*/
-static int req_ecall_cfg_set(ATPortType_enum port, const mbtk_ecall_cfg_info_t *cfg_info, int *cme_err)
+static int req_ecall_cfg_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const mbtk_ecall_cfg_info_t *cfg_info, int *cme_err)
{
int err = 0;
if(ecall_mode == MBTK_ECALL_MODE_TYPE_EU) {
@@ -668,7 +670,7 @@
}
if(cfg_info->type & MBTK_ECALL_CFG_T3) {
- if(cfg_ecalldata_set(port, MBTK_ECALL_CFG_ITEM_T3, cfg_info->data[MBTK_ECALL_CFG_ITEM_T3], cme_err)
+ if(cfg_ecalldata_set(sim_id, port, MBTK_ECALL_CFG_ITEM_T3, cfg_info->data[MBTK_ECALL_CFG_ITEM_T3], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -676,7 +678,7 @@
}
if(cfg_info->type & MBTK_ECALL_CFG_T5) {
- if(cfg_ecalldata_set(port, MBTK_ECALL_CFG_ITEM_T5, cfg_info->data[MBTK_ECALL_CFG_ITEM_T5], cme_err)
+ if(cfg_ecalldata_set(sim_id, port, MBTK_ECALL_CFG_ITEM_T5, cfg_info->data[MBTK_ECALL_CFG_ITEM_T5], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -684,7 +686,7 @@
}
if(cfg_info->type & MBTK_ECALL_CFG_T6) {
- if(cfg_ecalldata_set(port, MBTK_ECALL_CFG_ITEM_T6, cfg_info->data[MBTK_ECALL_CFG_ITEM_T6], cme_err)
+ if(cfg_ecalldata_set(sim_id, port, MBTK_ECALL_CFG_ITEM_T6, cfg_info->data[MBTK_ECALL_CFG_ITEM_T6], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -692,7 +694,7 @@
}
if(cfg_info->type & MBTK_ECALL_CFG_T7) {
- if(cfg_ecalldata_set(port, MBTK_ECALL_CFG_ITEM_T7, cfg_info->data[MBTK_ECALL_CFG_ITEM_T7], cme_err)
+ if(cfg_ecalldata_set(sim_id, port, MBTK_ECALL_CFG_ITEM_T7, cfg_info->data[MBTK_ECALL_CFG_ITEM_T7], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -700,7 +702,7 @@
}
if(cfg_info->type & MBTK_ECALL_CFG_TH) {
- if(cfg_ecalldata_set(port, MBTK_ECALL_CFG_ITEM_TH, cfg_info->data[MBTK_ECALL_CFG_ITEM_TH], cme_err)
+ if(cfg_ecalldata_set(sim_id, port, MBTK_ECALL_CFG_ITEM_TH, cfg_info->data[MBTK_ECALL_CFG_ITEM_TH], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON)
{
goto exit;
@@ -709,14 +711,14 @@
if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CALLBACK)
{
- if(cfg_ecalltimer_set(port, "callback", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] / 1000, cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "callback", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] / 1000, cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CLEARDOWN)
{
- if(cfg_ecalltimer_set(port, "cleardown", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] / 1000, cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "cleardown", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] / 1000, cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
@@ -724,49 +726,49 @@
if(cfg_info->type & MBTK_ECALL_CFG_TIMER_DEREG)
{
- if(cfg_ecalltimer_set(port, "dereg", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] / 1000, cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "dereg", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] / 1000, cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_TIMER_DIAL)
{
- if(cfg_ecalltimer_set(port, "dial", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] / 1000, cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "dial", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] / 1000, cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_TIMER_REDIAL)
{
- if(cfg_ecalltimer_set(port, "redialtmr", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] / 1000, cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "redialtmr", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] / 1000, cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_TIMER_SMS)
{
- if(cfg_ecalltimer_set(port, "sms", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] / 1000, cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "sms", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] / 1000, cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_REDIALCNT)
{
- if(cfg_ecalltimer_set(port, "redialcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_REDIALCNT], cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "redialcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_REDIALCNT], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_SMSPROCESS)
{
- if(cfg_ecalltimer_set(port, "smsprocess", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS], cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "smsprocess", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
}
if(cfg_info->type & MBTK_ECALL_CFG_SMSMSDCNT)
{
- if(cfg_ecalltimer_set(port, "smsmsdcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT], cme_err)
+ if(cfg_ecalltimer_set(sim_id, port, "smsmsdcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT], cme_err)
|| *cme_err != MBTK_RIL_ERR_CME_NON) {
goto exit;
}
@@ -781,12 +783,12 @@
OK
*/
-static int req_ecall_spkmute_set(ATPortType_enum port, int mute, int *cme_err)
+static int req_ecall_spkmute_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, int mute, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
sprintf(cmd, "AT*ECALLMUTESPK=%d", mute);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -805,11 +807,11 @@
OK
*/
-static int req_ecall_sms_num_get(ATPortType_enum port, uint8 *number, int *cme_err)
+static int req_ecall_sms_num_get(mbtk_sim_type_enum sim_id, ATPortType_enum port, uint8 *number, int *cme_err)
{
ATResponse *response = NULL;
char *tmp_ptr = NULL;
- int err = at_send_command_singleline(port, "AT*ECALLSMSNUM?", "*ECALLSMSNUM:", &response);
+ int err = at_send_command_singleline(portType_2_portId(sim_id, port), "AT*ECALLSMSNUM?", "*ECALLSMSNUM:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
*cme_err = at_get_cme_error(response);
@@ -844,12 +846,12 @@
OK
*/
-static int req_ecall_sms_num_set(ATPortType_enum port, const uint8 *number, int *cme_err)
+static int req_ecall_sms_num_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, const uint8 *number, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
sprintf(cmd, "AT*ECALLSMSNUM=%s", number);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -865,12 +867,12 @@
OK
*/
-static int req_ecall_gain_set(ATPortType_enum port, mbtk_ecall_gain_info_t *gain, int *cme_err)
+static int req_ecall_gain_set(mbtk_sim_type_enum sim_id, ATPortType_enum port, mbtk_ecall_gain_info_t *gain, int *cme_err)
{
ATResponse *response = NULL;
char cmd[100] = {0};
sprintf(cmd, "AT*AUDGAIN=%d,%d", gain->gain, gain->mode);
- int err = at_send_command(port, cmd, &response);
+ int err = at_send_command(portType_2_portId(sim_id, port), cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -899,7 +901,7 @@
else // Set
{
mbtk_ecall_msd_cfg_info_t *cfg_info = (mbtk_ecall_msd_cfg_info_t*)(pack->data);
- if(req_ecall_msdcfg(cli_info->port, cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_msdcfg(cli_info->sim_id, cli_info->port, cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -910,7 +912,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -919,7 +921,7 @@
{
if(pack->data_len == 0 || pack->data == NULL)
{
- if(req_ecall_msdgen(cli_info->port, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_msdgen(cli_info->sim_id, cli_info->port, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -930,7 +932,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
else // Set
@@ -945,7 +947,7 @@
memset(msd, 0, sizeof(msd));
if(pack->data_len == 0 || pack->data == NULL)
{
- if(req_ecall_msd_get(cli_info->port, msd, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_msd_get(cli_info->sim_id, cli_info->port, msd, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -956,13 +958,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, msd, strlen((char*)msd));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, msd, strlen((char*)msd));
}
}
else // Set
{
memcpy(msd, pack->data, pack->data_len);
- if(req_ecall_msd_set(cli_info->port, msd, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_msd_set(cli_info->sim_id, cli_info->port, msd, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -973,7 +975,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -982,7 +984,7 @@
{
if(pack->data_len == 0 || pack->data == NULL)
{
- if(req_ecall_push(cli_info->port, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_push(cli_info->sim_id, cli_info->port, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -993,7 +995,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
else // Set
@@ -1008,7 +1010,7 @@
{
mbtk_ecall_only_info_t only_info;
memset(&only_info, 0, sizeof(mbtk_ecall_only_info_t));
- if(req_ecall_only_get(cli_info->port, &only_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_only_get(cli_info->sim_id, cli_info->port, &only_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1019,13 +1021,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &only_info, sizeof(mbtk_ecall_only_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &only_info, sizeof(mbtk_ecall_only_info_t));
}
}
else // Set
{
mbtk_ecall_only_info_t *only_info = (mbtk_ecall_only_info_t*)(pack->data);
- if(req_ecall_only_set(cli_info->port, only_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_only_set(cli_info->sim_id, cli_info->port, only_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1036,7 +1038,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1050,7 +1052,7 @@
else
{
uint8 reg = pack->data[0];
- if(req_ecall_reg_set(cli_info->port, reg, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_reg_set(cli_info->sim_id, cli_info->port, reg, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1061,7 +1063,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1071,7 +1073,7 @@
if(pack->data_len == 0 || pack->data == NULL)
{
mbtk_ecall_dial_type_enum type;
- if(req_ecall_dial_state_get(cli_info->port, &type, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_dial_state_get(cli_info->sim_id, cli_info->port, &type, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1082,13 +1084,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &type, sizeof(uint8));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &type, sizeof(uint8));
}
}
else
{
mbtk_ecall_dial_type_enum type = (mbtk_ecall_dial_type_enum)pack->data[0];
- if(req_ecall_dial_start(cli_info->port, type, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_dial_start(cli_info->sim_id, cli_info->port, type, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1099,7 +1101,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1109,7 +1111,7 @@
if(pack->data_len == 0 || pack->data == NULL)
{
mbtk_ecall_mode_type_enum mode;
- if(req_ecall_mode_get(cli_info->port, &mode, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_mode_get(cli_info->sim_id, cli_info->port, &mode, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1120,13 +1122,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &mode, sizeof(uint8));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &mode, sizeof(uint8));
}
}
else
{
mbtk_ecall_mode_type_enum mode = (mbtk_ecall_mode_type_enum)pack->data[0];
- if(req_ecall_mode_set(cli_info->port, mode, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_mode_set(cli_info->sim_id, cli_info->port, mode, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1137,7 +1139,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1152,7 +1154,7 @@
{
if(pack->data_len == sizeof(mbtk_ecall_cfg_info_t)) { // Set
mbtk_ecall_cfg_info_t *cfg_info = (mbtk_ecall_cfg_info_t*)pack->data;
- if(req_ecall_cfg_set(cli_info->port, cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_cfg_set(cli_info->sim_id, cli_info->port, cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1163,13 +1165,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
} else { // Get
mbtk_ecall_cfg_info_t cfg_info;
memset(&cfg_info, 0, sizeof(mbtk_ecall_cfg_info_t));
uint32 *type = (uint32*)(pack->data);
- if(req_ecall_cfg_get(cli_info->port, *type, &cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_cfg_get(cli_info->sim_id, cli_info->port, *type, &cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1180,7 +1182,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &cfg_info, sizeof(mbtk_ecall_cfg_info_t));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &cfg_info, sizeof(mbtk_ecall_cfg_info_t));
}
}
}
@@ -1192,7 +1194,7 @@
memset(number, 0, sizeof(number));
if(pack->data_len == 0 || pack->data == NULL)
{
- if(req_ecall_sms_num_get(cli_info->port, number, &cme_err) || strlen((char*)number) == 0 || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_sms_num_get(cli_info->sim_id, cli_info->port, number, &cme_err) || strlen((char*)number) == 0 || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1203,13 +1205,13 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, number, strlen((char*)number));
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, number, strlen((char*)number));
}
}
else // Set
{
memcpy(number, pack->data, pack->data_len);
- if(req_ecall_sms_num_set(cli_info->port, number, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_sms_num_set(cli_info->sim_id, cli_info->port, number, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1220,7 +1222,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1241,7 +1243,7 @@
break;
}
- if(req_ecall_spkmute_set(cli_info->port, mute, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_spkmute_set(cli_info->sim_id, cli_info->port, mute, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1252,7 +1254,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;
@@ -1266,7 +1268,7 @@
else // Set
{
mbtk_ecall_gain_info_t *gain_info = (mbtk_ecall_gain_info_t *)pack->data;
- if(req_ecall_gain_set(cli_info->port, gain_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_ecall_gain_set(cli_info->sim_id, cli_info->port, gain_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
@@ -1277,7 +1279,7 @@
}
else
{
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
+ ril_rsp_pack_send(cli_info->sim_id, cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, NULL, 0);
}
}
break;