Fix ecall timer set/get

Change-Id: I5438c8d382411a18951c3575923479b1c3d28f39
diff --git a/mbtk/mbtk_rild_v2/src/ril_ecall.c b/mbtk/mbtk_rild_v2/src/ril_ecall.c
index dfb4ace..c86f922 100755
--- a/mbtk/mbtk_rild_v2/src/ril_ecall.c
+++ b/mbtk/mbtk_rild_v2/src/ril_ecall.c
@@ -21,6 +21,93 @@
 
 void ril_rsp_pack_send(int fd, int ril_id, int msg_index, const void* data, int data_len);
 
+static int cfg_ecalldata_get(mbtk_ecall_cfg_item_enum type, uint32 *value, int *cme_err)
+{
+    ATResponse *response = NULL;
+    char *tmp_ptr = NULL;
+    int tmp_int;
+    char cmd[100] = {0};
+    int err = 0;
+
+    snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d", type);
+    err = at_send_command_singleline(cmd, "*ECALLDATA:", &response);
+
+    if (err < 0 || response->success == 0 || !response->p_intermediates){
+        *cme_err = at_get_cme_error(response);
+        goto exit;
+    }
+
+    char *line = response->p_intermediates->line;
+    err = at_tok_start(&line);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    err = at_tok_nextint(&line, &tmp_int);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    err = at_tok_nextint(&line, &tmp_int);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    err = at_tok_nextint(&line, &tmp_int);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    *value = (uint32)(tmp_int * 20);   // ms
+
+    goto exit;
+exit:
+    at_response_free(response);
+    return err;
+}
+
+static int cfg_ecalldata_set(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(cmd, &response);
+    if (err < 0 || response->success == 0){
+        *cme_err = at_get_cme_error(response);
+        goto exit;
+    }
+
+    goto exit;
+exit:
+    at_response_free(response);
+    return err;
+}
+
+static int cfg_ecalltimer_set(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(cmd, &response);
+    if (err < 0 || response->success == 0){
+        *cme_err = at_get_cme_error(response);
+        goto exit;
+    }
+
+    goto exit;
+exit:
+    at_response_free(response);
+    return err;
+}
+
 static int req_ecall_msdcfg(mbtk_ecall_msd_cfg_info_t *cfg_info, int *cme_err)
 {
     ATResponse *response = NULL;
@@ -371,66 +458,71 @@
 OK
 
 */
-static int req_ecall_cfg_get(mbtk_ecall_cfg_item_enum type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
+static int req_ecall_cfg_get(uint32 type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
 {
     ATResponse *response = NULL;
     char *tmp_ptr = NULL;
     int tmp_int;
-    char cmd[1024] = {0};
     int err = 0;
 
     cfg->type = type;
-    switch(type)
-    {
-        case MBTK_ECALL_CFG_ITEM_T3:
-        case MBTK_ECALL_CFG_ITEM_T5:
-        case MBTK_ECALL_CFG_ITEM_T6:
-        case MBTK_ECALL_CFG_ITEM_T7:
-        case MBTK_ECALL_CFG_ITEM_TH:
-            snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d", type);
 
-            err = at_send_command_singleline(cmd, "*ECALLDATA:", &response);
-            break;
-        default:
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER?");
-
-            err = at_send_command_singleline(cmd, "*ECALLTIMER:", &response);
-            break;
+    if(type & MBTK_ECALL_CFG_T3) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T3, &(cfg->data[MBTK_ECALL_CFG_ITEM_T3]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
     }
 
-    if (err < 0 || response->success == 0 || !response->p_intermediates){
-        *cme_err = at_get_cme_error(response);
-        goto exit;
+    if(type & MBTK_ECALL_CFG_T5) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T5, &(cfg->data[MBTK_ECALL_CFG_ITEM_T5]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
     }
 
-    char *line = response->p_intermediates->line;
-    err = at_tok_start(&line);
-    if (err < 0)
-    {
-        goto exit;
+    if(type & MBTK_ECALL_CFG_T6) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T6, &(cfg->data[MBTK_ECALL_CFG_ITEM_T6]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
     }
 
-    if(strstr(cmd, "AT*ECALLDATA")) {
-        err = at_tok_nextint(&line, &tmp_int);
+    if(type & MBTK_ECALL_CFG_T7) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T7, &(cfg->data[MBTK_ECALL_CFG_ITEM_T7]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(type & MBTK_ECALL_CFG_TH) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_TH, &(cfg->data[MBTK_ECALL_CFG_ITEM_TH]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    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("AT*ECALLTIMER?", "*ECALLTIMER:", &response);
+        if (err < 0 || response->success == 0 || !response->p_intermediates){
+            *cme_err = at_get_cme_error(response);
+            goto exit;
+        }
+
+        char *line = response->p_intermediates->line;
+        err = at_tok_start(&line);
         if (err < 0)
         {
             goto exit;
         }
 
-        err = at_tok_nextint(&line, &tmp_int);
-        if (err < 0)
-        {
-            goto exit;
-        }
-
-        err = at_tok_nextint(&line, &tmp_int);
-        if (err < 0)
-        {
-            goto exit;
-        }
-
-        cfg->data = (uint32)(tmp_int * 20);   // ms
-    } else {
         // *ECALLTIMER: ERA mode, callback timer: 1200s,
         // dial setup timer: 30s, NAD deregister timer: 7200s,
         // cleardown timer: 3600s, redial attempts count: 10,
@@ -443,80 +535,73 @@
             ecall_mode = MBTK_ECALL_MODE_TYPE_EU;
         }
 
-        switch(type)
+        if(type & MBTK_ECALL_CFG_TIMER_CALLBACK)
         {
-            case MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK:
-            {
-                if((tmp_ptr = strstr(line, "callback timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 16);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+            if((tmp_ptr = strstr(line, "callback timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] = (uint32)atoi(tmp_ptr + 16);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN:
-            {
-                if((tmp_ptr = strstr(line, "cleardown timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 17);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_CLEARDOWN)
+        {
+            if((tmp_ptr = strstr(line, "cleardown timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] = (uint32)atoi(tmp_ptr + 17);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_DEREG:
-            {
-                if((tmp_ptr = strstr(line, "deregister timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 18);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_DEREG)
+        {
+            if((tmp_ptr = strstr(line, "deregister timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] = (uint32)atoi(tmp_ptr + 18);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_DIAL:
-            {
-                if((tmp_ptr = strstr(line, "dial setup timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 18);   // s
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_DIAL)
+        {
+            if((tmp_ptr = strstr(line, "dial setup timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] = (uint32)atoi(tmp_ptr + 18);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_REDIAL:
-            {
-                if((tmp_ptr = strstr(line, "redial wait timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 19);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_REDIAL)
+        {
+            if((tmp_ptr = strstr(line, "redial wait timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] = (uint32)atoi(tmp_ptr + 19);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_SMS:
-            {
-                if((tmp_ptr = strstr(line, "SMS resend timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 18);
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_SMS)
+        {
+            if((tmp_ptr = strstr(line, "SMS resend timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] = (uint32)atoi(tmp_ptr + 18);
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_REDIALCNT:
-            {
-                if((tmp_ptr = strstr(line, "redial attempts count: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 23);
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_REDIALCNT)
+        {
+            if((tmp_ptr = strstr(line, "redial attempts count: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_REDIALCNT] = (uint32)atoi(tmp_ptr + 23);
             }
-            case MBTK_ECALL_CFG_ITEM_SMSPROCESS:
-            {
-                if((tmp_ptr = strstr(line, "smsprocess: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 12);
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_SMSPROCESS)
+        {
+            if((tmp_ptr = strstr(line, "smsprocess: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS] = (uint32)atoi(tmp_ptr + 12);
             }
-            case MBTK_ECALL_CFG_ITEM_SMSMSDCNT:
-            {
-                if((tmp_ptr = strstr(line, "sms msd send count: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 20);
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_SMSMSDCNT)
+        {
+            if((tmp_ptr = strstr(line, "sms msd send count: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT] = (uint32)atoi(tmp_ptr + 20);
             }
-            default:
-                LOGE("Unknown config item : %d", type);
-                err = -1;
-                break;
         }
     }
 
@@ -535,88 +620,123 @@
 */
 static int req_ecall_cfg_set(const mbtk_ecall_cfg_info_t *cfg_info, int *cme_err)
 {
-    ATResponse *response = NULL;
-    char cmd[1024] = {0};
     int err = 0;
-
     if(ecall_mode == MBTK_ECALL_MODE_TYPE_EU) {
-        if(cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK
-            && cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_DIAL
-            && cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_DEREG
-            && cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN){
+        if((cfg_info->type & MBTK_ECALL_CFG_TIMER_REDIAL)
+            || (cfg_info->type & MBTK_ECALL_CFG_TIMER_SMS)
+            || (cfg_info->type & MBTK_ECALL_CFG_REDIALCNT)
+            || (cfg_info->type & MBTK_ECALL_CFG_SMSPROCESS)
+            || (cfg_info->type & MBTK_ECALL_CFG_SMSMSDCNT)){
             LOGW("No support for EU.");
             return -1;
         }
     }
 
-    switch(cfg_info->type)
-    {
-        case MBTK_ECALL_CFG_ITEM_T3:
-        case MBTK_ECALL_CFG_ITEM_T5:
-        case MBTK_ECALL_CFG_ITEM_T6:
-        case MBTK_ECALL_CFG_ITEM_T7:
-        case MBTK_ECALL_CFG_ITEM_TH:
-            snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d,%d", cfg_info->type, cfg_info->data / 20);
-            break;
-        case MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK:
+    if(cfg_info->type & MBTK_ECALL_CFG_T3) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T3, cfg_info->data[MBTK_ECALL_CFG_ITEM_T3], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
         {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=callback,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=cleardown,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_DEREG:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=dereg,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_DIAL:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=dial,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_REDIAL:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=redialtmr,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_SMS:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=sms,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_REDIALCNT:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=redialcnt,%d", cfg_info->data);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_SMSPROCESS:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=smsprocess,%d", cfg_info->data);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_SMSMSDCNT:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=smsmsdcnt,%d", cfg_info->data);
-            break;
-        }
-        default:
-            LOGE("Unknown config item : %d", cfg_info->type);
-            err = -1;
             goto exit;
+        }
     }
 
-    err = at_send_command(cmd, &response);
-    if (err < 0 || response->success == 0){
-        *cme_err = at_get_cme_error(response);
-        goto exit;
+    if(cfg_info->type & MBTK_ECALL_CFG_T5) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T5, cfg_info->data[MBTK_ECALL_CFG_ITEM_T5], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_T6) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T6, cfg_info->data[MBTK_ECALL_CFG_ITEM_T6], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_T7) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T7, cfg_info->data[MBTK_ECALL_CFG_ITEM_T7], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_TH) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_TH, cfg_info->data[MBTK_ECALL_CFG_ITEM_TH], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CALLBACK)
+    {
+        if(cfg_ecalltimer_set("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("cleardown", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_DEREG)
+    {
+        if(cfg_ecalltimer_set("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_ITEM_TIMER_DIAL)
+    {
+        if(cfg_ecalltimer_set("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_ITEM_TIMER_REDIAL)
+    {
+        if(cfg_ecalltimer_set("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_ITEM_TIMER_SMS)
+    {
+        if(cfg_ecalltimer_set("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_ITEM_REDIALCNT)
+    {
+        if(cfg_ecalltimer_set("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_ITEM_SMSPROCESS)
+    {
+        if(cfg_ecalltimer_set("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_ITEM_SMSMSDCNT)
+    {
+        if(cfg_ecalltimer_set("smsmsdcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
     }
 
 exit:
-    at_response_free(response);
     return err;
 }
 
@@ -1003,7 +1123,7 @@
                         } else {
                             err = MBTK_RIL_ERR_UNKNOWN;
                         }
-                        LOG("Set ecall config[%d] fail.", cfg_info->type);
+                        LOG("Set ecall config[%x] fail.", cfg_info->type);
                     }
                     else
                     {
@@ -1012,15 +1132,15 @@
                 } else { // Get
                     mbtk_ecall_cfg_info_t cfg_info;
                     memset(&cfg_info, 0, sizeof(mbtk_ecall_cfg_info_t));
-                    mbtk_ecall_cfg_item_enum type = (mbtk_ecall_cfg_item_enum)pack->data[0];
-                    if(req_ecall_cfg_get(type, &cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+                    uint32 *type = (uint32*)(pack->data);
+                    if(req_ecall_cfg_get(*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;
                         } else {
                             err = MBTK_RIL_ERR_UNKNOWN;
                         }
-                        LOG("Get ecall config[%d] fail.", type);
+                        LOG("Get ecall config[%x] fail.", *type);
                     }
                     else
                     {