优化demo代码和api接口

Change-Id: I094570a31d63204aaa5da809751e27acd60f60d8
diff --git a/mbtk/liblynq_lib/src/lynq_network.c b/mbtk/liblynq_lib/src/lynq_network.c
index 6ea8325..98bf359 100755
--- a/mbtk/liblynq_lib/src/lynq_network.c
+++ b/mbtk/liblynq_lib/src/lynq_network.c
@@ -1,6 +1,7 @@
 #include "lynq_qser_network.h"
 #include "mbtk_type.h"
 #include "mbtk_info_api.h"
+#include "mbtk_log.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -795,4 +796,67 @@
     return 0;
 }
 
+int qser_nw_set_ims_enable(nw_client_handle_type        h_nw, E_QSER_NW_IMS_MODE_TYPE_T ims_mode)
+{
+    int ret = 0;
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    ret = mbtk_net_ims_set(lynq_nw_info_handle, ims_mode);
+    if (ret != 0)
+    {
+        LOGE("mbtk_net_ims_set fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_nw_get_ims_reg_status(nw_client_handle_type h_nw, QSER_NW_IMS_REG_STATUS_INFO_T *pt_info)
+{
+    int ret = 0;
+    int tmp_pt;
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    ret = mbtk_net_ims_get(lynq_nw_info_handle, &tmp_pt);
+    if (ret != 0)
+    {
+        LOGE("mbtk_net_ims_get fail.");
+        return -1;
+    }
+
+    if (tmp_pt == 0)
+        pt_info->registration_state = E_QSER_NW_IMS_SERVICE_NONE;
+    else if (tmp_pt == 1)
+        pt_info->registration_state = E_QSER_NW_IMS_SERVICE_REGISTERED;
+    else
+    {
+        LOGE("mbtk_net_ims_get value error fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
 
diff --git a/mbtk/liblynq_lib/src/lynq_sms.c b/mbtk/liblynq_lib/src/lynq_sms.c
index 955e4d9..519d21a 100755
--- a/mbtk/liblynq_lib/src/lynq_sms.c
+++ b/mbtk/liblynq_lib/src/lynq_sms.c
@@ -3,6 +3,7 @@
 #include "mbtk_pdu_sms.h"
 #include "mbtk_info_api.h"
 #include "lynq_sms.h"
+#include "mbtk_log.h"
 
 
 #include <stdio.h>
diff --git a/mbtk/liblynq_lib/src/lynq_voice_call.c b/mbtk/liblynq_lib/src/lynq_voice_call.c
index 4125130..ad83d22 100755
--- a/mbtk/liblynq_lib/src/lynq_voice_call.c
+++ b/mbtk/liblynq_lib/src/lynq_voice_call.c
Binary files differ
diff --git a/mbtk/test/liblynq_lib/lynq_call_test.c b/mbtk/test/liblynq_lib/lynq_call_test.c
index c68d92e..670eb10 100755
--- a/mbtk/test/liblynq_lib/lynq_call_test.c
+++ b/mbtk/test/liblynq_lib/lynq_call_test.c
@@ -300,22 +300,23 @@
     voice_client_handle_type handle = -1;
     int  voice_call_id = 0;
     mbtk_log_init("radio", "CALL_TEST");
-
+    
+    printf("=========call main=========\n"
+        "\t0 exit\n"
+        "\t1 call init\n"
+        "\t2 call add register handle\n"
+        "\t3 call start\n"
+        "\t4 call end\n"
+        "\t5 call answer\n"
+        "\t6 call remove register handle\n"
+        "\t7 call set volume level 0-5\n"
+        "\t8 call get volume\n"
+        "\t9 call dtmf\n"
+        "\t10 call deinit\n"
+        "operator: >> \n");
+    
     while(1)
     {
-        printf("=========call main=========\n"
-            "\t0 exit\n"
-            "\t1 call init\n"
-            "\t2 call add register handle\n"
-            "\t3 call start\n"
-            "\t4 call end\n"
-            "\t5 call answer\n"
-            "\t6 call remove register handle\n"
-            "\t7 call set volume level 0-5\n"
-            "\t8 call get volume\n"
-            "\t9 call deinit\n"
-            "operator: >> \n");
-
         fgets(operator, sizeof(operator), stdin);
         fflush(stdin);
         opt = atoi(operator);
@@ -362,6 +363,20 @@
             printf("volume level = %d\n",lv_voll);
             break;
         case 9:
+            {
+                char inputChar;
+                
+                printf("Enter set dtmf\n");
+                scanf(" %c", &inputChar);
+                printf("inputChar is %c\n", inputChar);
+                
+                if (qser_voice_set_dtmf(inputChar) != 0) 
+                {
+                    printf("qser set voice dtmf failed\n");
+                }
+            }
+            break;
+        case 10:
             qser_voice_call_client_deinit(handle);
             break;
         default:
diff --git a/mbtk/test/liblynq_lib/lynq_nw_test.c b/mbtk/test/liblynq_lib/lynq_nw_test.c
index 82cd6d8..32ffc94 100755
--- a/mbtk/test/liblynq_lib/lynq_nw_test.c
+++ b/mbtk/test/liblynq_lib/lynq_nw_test.c
@@ -47,26 +47,31 @@
     char operator[10];
     int opt;
     int lv_voll = 0;
+    int ret;
     nw_client_handle_type handle = -1;
     mbtk_log_init("radio", "NW_TEST");
 
+    printf("=========network main=========\n"
+        "\t0 exit\n"
+        "\t1 network init\n"
+        "\t2 network add rx msg handle\n"
+        "\t3 network band set config\n"
+        "\t4 network get operator name\n"
+        "\t5 network get reg status\n"
+        "\t6 network get signal strength\n"
+        "\t7 network set oos config\n"
+        "\t8 network get oos config\n"
+        "\t9 network set rf config\n"
+        "\t10 network get rf config\n"
+        "\t11 network set ims config\n"
+        "\t12 network get ims config\n"
+        "\t13 network deinit\n"
+        "operator: >> ");
+
     while(1)
     {
-        printf("=========network main=========\n"
-            "\t0 exit\n"
-            "\t1 network init\n"
-            "\t2 network add rx msg handle\n"
-            "\t3 network band set config\n"
-            "\t4 network get operator name\n"
-            "\t5 network get reg status\n"
-            "\t6 network get signal strength\n"
-            "\t7 network set oos config\n"
-            "\t8 network get oos config\n"
-            "\t9 network set rf config\n"
-            "\t10 network get rf config\n"
-            "\t11 network deinit\n"
-            "operator: >> ");
 
+        opt = -1;
         fgets(operator, sizeof(operator), stdin);
         fflush(stdin);
         opt = atoi(operator);
@@ -76,10 +81,12 @@
             printf("main exit\n");
             return 0;
         case 1:
-            qser_nw_client_init(&handle);
+            ret = qser_nw_client_init(&handle);
+            printf("qser_nw_client_init ret = %d\n", ret);
             break;
         case 2:
-            qser_nw_add_rx_msg_handler(handle, nw_event_ind_handler, NULL);
+            ret = qser_nw_add_rx_msg_handler(handle, nw_event_ind_handler, NULL);
+            printf("qser_nw_add_rx_msg_handler ret = %d\n", ret);
             break;
         case 3:
             {
@@ -121,7 +128,8 @@
                         t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G
                         break;
                 }
-                qser_nw_set_config(handle, &t_info);
+                ret = qser_nw_set_config(handle, &t_info);
+                printf("qser_nw_set_config ret = %d\n", ret);
             }
             break;
         case 4:
@@ -220,7 +228,8 @@
                 }
                 printf("set OOS %d %d %d \n",pt_info_s.u.full_band_scan_info.t_min, pt_info_s.u.full_band_scan_info.t_step, pt_info_s.u.full_band_scan_info.t_max);
                 //pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FAST_SCAN;平台本身有历史频点优先处理的逻辑(无接口不需要我们进行处理)
-                qser_nw_set_oos_config(handle, &pt_info_s);
+                ret = qser_nw_set_oos_config(handle, &pt_info_s);
+                printf("qser_nw_set_oos_config ret = %d\n", ret);
             }
             break;
         case 8:
@@ -241,7 +250,8 @@
                 fflush(stdin);
                 opt = atoi(operator);
                 printf("rf_mode: [%d]\n",opt);
-                qser_nw_set_rf_mode(handle, opt);
+                ret = qser_nw_set_rf_mode(handle, opt);
+                printf("qser_nw_set_rf_mode ret = %d\n", ret);
             }
             break;
         case 10:
@@ -252,6 +262,27 @@
             }
             break;
         case 11:
+            {
+                E_QSER_NW_IMS_MODE_TYPE_T  ims_mode;
+                printf("please input you want set ims mode (0: off;  1: volte enable \n");
+                scanf("%d", &ims_mode);
+                ret = qser_nw_set_ims_enable(handle, ims_mode);
+                printf("qser_nw_set_ims_enable %d ret = %d\n",ims_mode, ret);
+            }
+            break;
+        case 12:
+            {
+                QSER_NW_IMS_REG_STATUS_INFO_T         t_info;
+                memset(&t_info, 0, sizeof(QSER_NW_IMS_REG_STATUS_INFO_T));
+                ret = qser_nw_get_ims_reg_status(handle, &t_info);
+                printf("qser_nw_get_ims_reg_status ret = %d, detail info:\n", ret);
+                if(ret == 0)
+                {
+                    printf("ims_registration: registration_state=%d\n", t_info.registration_state);
+                }
+            }
+            break;
+        case 13:
             qser_nw_client_deinit(handle);
             break;
         default:
diff --git a/mbtk/test/liblynq_lib/lynq_qser_sms_test.c b/mbtk/test/liblynq_lib/lynq_qser_sms_test.c
index 9128cf0..a2d1795 100755
--- a/mbtk/test/liblynq_lib/lynq_qser_sms_test.c
+++ b/mbtk/test/liblynq_lib/lynq_qser_sms_test.c
@@ -274,20 +274,21 @@
     QSER_sms_storage_info_t test_sms_storage;

     mbtk_log_init("radio", "SMS_TEST");

 

+    printf("=========sms main=========\n"

+        "\t0 exit\n"

+        "\t1 sms init\n"

+        "\t2 send text sms\n"

+        "\t3 wait receive new sms\n"

+        "\t4 send PDU sms\n"

+        "\t5 //delete sms list\n"

+        "\t6 delete sms\n"

+        "\t7 query service number\n"

+        "\t8 set service number\n"

+        "\t9 deinit sms\n"

+        "operator: >> \n");

+

     while(1)

     {

-        printf("=========sms main=========\n"

-            "\t0 exit\n"

-            "\t1 sms init\n"

-            "\t2 send text sms\n"

-            "\t3 wait receive new sms\n"

-            "\t4 send PDU sms\n"

-            "\t5 //delete sms list\n"

-            "\t6 delete sms\n"

-            "\t7 query service number\n"

-            "\t8 set service number\n"

-            "\t9 deinit sms\n"

-            "operator: >> \n");

         fgets(operator, sizeof(operator), stdin);

         fflush(stdin);

         opt = atoi(operator);

diff --git a/mbtk/test/liblynq_lib/lynq_sleep_test.c b/mbtk/test/liblynq_lib/lynq_sleep_test.c
index 34b7412..4bfbf40 100755
--- a/mbtk/test/liblynq_lib/lynq_sleep_test.c
+++ b/mbtk/test/liblynq_lib/lynq_sleep_test.c
@@ -45,20 +45,21 @@
     int fd_t;
     mbtk_log_init("radio", "SLEEP_TEST");
 
+    printf("=========sleep main=========\n"
+        "\t0 exit\n"
+        "\t1 autosuspend enable\n"
+        "\t2 wakelock create\n"
+        "\t3 wakelock lock\n"
+        "\t4 wakelock unlock\n"
+        "\t5 wakelock destroy\n"
+        "\t6 whitelist set\n"
+        "\t7 whitelist get\n"
+        "\t8 lpm init\n"
+        "\t9 lpm destroy\n"
+        "operator: >> \n");
+
     while(1)
     {
-        printf("=========sleep main=========\n"
-            "\t0 exit\n"
-            "\t1 autosuspend enable\n"
-            "\t2 wakelock create\n"
-            "\t3 wakelock lock\n"
-            "\t4 wakelock unlock\n"
-            "\t5 wakelock destroy\n"
-            "\t6 whitelist set\n"
-            "\t7 whitelist get\n"
-            "\t8 lpm init\n"
-            "\t9 lpm destroy\n"
-            "operator: >> \n");
 
         fgets(operator, sizeof(operator), stdin);
         fflush(stdin);
diff --git a/mbtk/test/liblynq_lib_t106/lynq-qser-network-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-network-demo.cpp
index ad38820..585b3aa 100755
--- a/mbtk/test/liblynq_lib_t106/lynq-qser-network-demo.cpp
+++ b/mbtk/test/liblynq_lib_t106/lynq-qser-network-demo.cpp
@@ -14,7 +14,7 @@
 

 void *handle_network;

 

-int (*qser_nw_client_init_p)(nw_client_handle_type  * ph_nw);

+int (*qser_nw_client_init_p)(nw_client_handle_type  * h_nw);

 int (*qser_nw_client_deinit_p)(nw_client_handle_type h_nw);

 int (*qser_nw_set_config_p)(nw_client_handle_type  h_nw, QSER_NW_CONFIG_INFO_T *pt_info);

 int (*qser_nw_get_operator_name_p)(nw_client_handle_type    h_nw, QSER_NW_OPERATOR_NAME_INFO_T    *pt_info );

@@ -41,7 +41,7 @@
         exit(EXIT_FAILURE);

     }

 

-    qser_nw_client_init_p = (int (*)(nw_client_handle_type  * ph_nw))dlsym(handle_network,"qser_nw_client_init");    

+    qser_nw_client_init_p = (int (*)(nw_client_handle_type  * h_nw))dlsym(handle_network,"qser_nw_client_init");    

     qser_nw_client_deinit_p = (int (*)(nw_client_handle_type h_nw))dlsym(handle_network,"qser_nw_client_deinit");

     qser_nw_set_config_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_set_config");

     qser_nw_get_operator_name_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_OPERATOR_NAME_INFO_T  *pt_info ))dlsym(handle_network,"qser_nw_get_operator_name");

diff --git a/mbtk/test/liblynq_lib_t106/lynq_qser_network.h b/mbtk/test/liblynq_lib_t106/lynq_qser_network.h
index 56e2ce0..577868e 100755
--- a/mbtk/test/liblynq_lib_t106/lynq_qser_network.h
+++ b/mbtk/test/liblynq_lib_t106/lynq_qser_network.h
@@ -10,6 +10,8 @@
 extern "C" {
 #endif
 
+#include "mbtk_type.h"
+
 typedef uint32_t nw_client_handle_type;