[Bugfix][T106BUG-109][NetWork] call  lynq_oos_recover_timer_interval ret 6003

       Affected branch: unknown
       Affected module: unknown
       Is it affected on both ZXIC and MTK: ZXIC only
       Self-test: Yes
       Doc Update: Yes

Change-Id: I99c753ea269ec6cb91d7fa7697c9c98b9cfff2c8
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
index 8ef97ca..0b1dd7d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
@@ -21,6 +21,10 @@
 int (*qser_nw_get_reg_status_p)(nw_client_handle_type  h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info);

 int (*qser_nw_add_rx_msg_handler_p)(nw_client_handle_type  h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr);

 int (*qser_nw_get_signal_strength_p)(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info);

+int (*qser_nw_set_oos_config_p)(nw_client_handle_type   h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);

+int (*qser_nw_get_oos_config_p)(nw_client_handle_type   h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);

+

+

 

 int getFunc()

 {

@@ -40,6 +44,9 @@
     qser_nw_get_reg_status_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_REG_STATUS_INFO_T  *pt_info))dlsym(handle_network,"qser_nw_get_reg_status");

     qser_nw_get_signal_strength_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_signal_strength");

     qser_nw_add_rx_msg_handler_p = (int (*)(nw_client_handle_type  h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr))dlsym(handle_network,"qser_nw_add_rx_msg_handler");

+    qser_nw_get_oos_config_p = (int (*)(nw_client_handle_type   h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_oos_config");

+    qser_nw_set_oos_config_p = (int (*)(nw_client_handle_type   h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_set_oos_config");

+

         

     if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL ||

        qser_nw_get_operator_name_p == NULL || qser_nw_get_reg_status_p ==NULL || qser_nw_add_rx_msg_handler_p==NULL)

@@ -78,7 +85,11 @@
     {3,     "qser_nw_get_reg_status"},        

     {4,     "qser_nw_add_rx_msg_handler"},     

     {5,     "qser_nw_get_signal_strength"},

-    {6,     "qser_nw_client_deinit"},  

+    {6,     "qser_nw_set_oos_config"},

+    {7,     "qser_nw_get_oos_config"},

+    {8,     "qser_nw_client_deinit"},  

+ 

+    

     {-1,    "quit"}

 };

 

@@ -424,7 +435,7 @@
                              

                  break;

              }                 

-             case 6://"qser_nw_client_deinit"

+             case 8://"qser_nw_client_deinit"

              {

                  ret = qser_nw_client_deinit_p(h_nw);

                  printf("qser_nw_client_deinit ret = %d\n", ret);

@@ -475,7 +486,76 @@
                 }

                 break;

              }        

-            

+             case 7 :

+             {

+                QSER_NW_OOS_CONFIG_INFO_T t_info;

+                int type = 0;

+                printf("please input you want query oos config's type (0: fast network scan config; 1: full band network scan config ) : \n");

+                scanf("%d", &type);

+                t_info.type = type;

+                ret = qser_nw_get_oos_config_p(h_nw, &t_info);  

+                printf("qser_nw_get_oos_config, ret=%d\n", ret);

+                if(ret==0)

+                {         

+                    if(t_info.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)

+                    {

+                        printf("qser_nw_get_oos_config         t_min = %d\n"

+                               "                               t_step = %d\n"

+                               "                               t_num = %d\n"

+                               "                               t_max = %d\n",

+                              t_info.u.full_band_scan_info.t_min, t_info.u.full_band_scan_info.t_step,                             

+                              t_info.u.full_band_scan_info.t_num, t_info.u.full_band_scan_info.t_max);

+                    }     

+                    else if(t_info.type == QSER_NW_OOS_CFG_TYPE_FAST_SCAN)

+                    {

+                        printf("qser_nw_get_oos_config         enable = %d\n"

+                               "                               time_interval = %d\n",

+                              t_info.u.fast_can_info.enable, t_info.u.fast_can_info.time_interval); 

+                    }

+                    else

+                    {

+                        printf("qser_nw_get_oos_config tyep is %d, ret is ok",t_info.type);

+                    }

+    

+                }

+                break;

+             }         

+             case 6 :

+             {

+                QSER_NW_OOS_CONFIG_INFO_T t_info;

+                int type = 0;

+                printf("please input you want set oos config's type (0: fast network scan config; 1: full band network scan config ) : \n");

+                scanf("%d", &type);

+                t_info.type = type;

+                if(t_info.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)

+                {

+                      printf("please input  t_min: \n");

+                      scanf("%d", &(t_info.u.full_band_scan_info.t_min));

+                      printf("please input t_step: \n");

+                      scanf("%d", &(t_info.u.full_band_scan_info.t_step));

+                      printf("please input  t_num: \n");

+                      scanf("%d", &(t_info.u.full_band_scan_info.t_num));

+                      printf("please input t_max: \n");

+                      scanf("%d", &(t_info.u.full_band_scan_info.t_max));

+                      ret = qser_nw_set_oos_config_p(h_nw, &t_info);  

+                      printf("qser_nw_get_oos_config, ret=%d\n", ret);                      

+                }

+                else if(t_info.type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)

+                {

+                      printf("please input  enable: \n");

+                      scanf("%d", &(t_info.u.fast_can_info.enable));

+                      printf("please input time_interval: \n");

+                      scanf("%d", &(t_info.u.fast_can_info.time_interval));                      

+                      ret = qser_nw_set_oos_config_p(h_nw, &t_info);  

+                      printf("qser_nw_get_oos_config, ret=%d\n", ret);                    

+                }

+                else 

+                {

+                       ret = qser_nw_set_oos_config_p(h_nw, &t_info);  

+                       printf("qser_nw_get_oos_config, ret=%d\n", ret);            

+                }                

+                break;

+             }         

              default:

              {

                  show_group_help(&t_nw_test);

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
index b65e428..4083e13 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
@@ -35,6 +35,37 @@
     E_QSER_NW_ROAM_STATE_TYPE_T   roaming_pref;       /**<   Roaming preference.*/
 }QSER_NW_CONFIG_INFO_T;
 
+/** Configures the OOS (out of service)  settings that define the MCM network interface. */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN          0x00    /**<  fast net scan */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN     0x01    /**<  full band scan */
+
+typedef struct 
+{
+    /*    Configuration parameters for MCM network fast network scan when OOS (out of service)*/
+    char                        enable;
+    uint16_t                    time_interval;
+}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
+
+typedef struct 
+{
+    /*    Configuration parameters for MCM network full band network scan when OOS (out of service)*/
+    int t_min;
+    int t_step;
+    int t_num;
+    int t_max;
+}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
+
+
+typedef struct 
+{    
+    char                        type;  /**<   QSER_NW_OOS_CFG_TYPE_xxxx.*/
+    union {
+    QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T  fast_can_info;       // 00
+    QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info;     // 01   
+  } u;
+}QSER_NW_OOS_CONFIG_INFO_T;
+
+
 
 //defined for QSER_NW_EventRegister
 #define     NW_IND_VOICE_REG_EVENT_IND_FLAG               (1 << 0)    /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
@@ -346,6 +377,18 @@
     QSER_NW_CONFIG_INFO_T     *pt_info 
 );
 
+int qser_nw_set_oos_config
+(
+    nw_client_handle_type       h_nw,
+    QSER_NW_OOS_CONFIG_INFO_T     *pt_info 
+);
+
+int qser_nw_get_oos_config
+(
+    nw_client_handle_type       h_nw,
+    QSER_NW_OOS_CONFIG_INFO_T     *pt_info 
+);
+
 int qser_nw_event_register
 (
     nw_client_handle_type       h_nw,
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
index 462df68..e878e6b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
@@ -7,6 +7,7 @@
 #define CELLINFO_MAX_NUM  10

 #define LY_RECOVER_TIMER_INTERVAL 128

 #define MAX_CELLINFO_ITEM_NUMBER 32

+#define MAX_OOS_CFG_ITEM_NUMBER 32

 /*T800 platform support gsm,wcdma lte,nr */

 typedef struct{

     int gw_sig_valid; /*1 valid,1 invalid*/

@@ -134,6 +135,10 @@
 */

 int lynq_oos_deep_sleep_recover_timer_interval(int recovery_threshold,int fullband_timer,int sniffer_timer,int inactive_mode);

 #endif

+#if (defined MOBILETEK_TARGET_PLATFORM_T106) || (defined MODEM_GEN97)

+int lynq_set_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int valid_num);

+int lynq_get_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int* valid_num);

+#endif

 void lynq_set_test_mode(const int test_mode);

 #ifdef __cplusplus

 }

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index dc16ae4..6a1b35b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -25,6 +25,8 @@
 /*in CR AUTO00207414, in modem, 23G detach need 10s, 5g ims detach need 5s, so set length to 12s */

 #define WAIT_TIME_LENGTH_FOR_SET_PREFFERRED_NETWORK_TYPE (12) 

 

+#define MAX_AT_INT_RSP_NUM  32

+

 

 using ::android::Parcel;

 

@@ -1240,42 +1242,6 @@
     return RESULT_OK;                

 }

 

-int lynq_radio_on(const lynq_network_radio_on_type type)

-{     

-    if(g_module_init_flag != MODULE_RUNNING)

-    {

-        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

-        return LYNQ_E_CONFLICT;

-    }

-    if (type != NETWORK_RADIO_ON_TYPE_CFUN_0  && type != NETWORK_RADIO_ON_TYPE_NORMAL_MODE && type!=NETWORK_RADIO_ON_TYPE_FLIGHT_MODE)

-    {

-        LYERRLOG("%s parameter %d error",__func__,type);  

-        return LYNQ_E_PARAMETER_ANONALY;

-    }     

-    

-    Parcel* p=NULL;      

-    int ret;

-

-    if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)

-    {

-        ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+CFUN=0");

-    }

-    else 

-    {

-        ret=lynq_send_common_request(p,65,RIL_REQUEST_RADIO_POWER,1,"%d",(type==NETWORK_RADIO_ON_TYPE_NORMAL_MODE));

-    }

-

-    if(ret!=RESULT_OK)

-    {

-        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

-        return ret;  

-    }       

-

-    LYINFLOG("%s set %d suc",__func__,type);  

-    delete p;

-    return RESULT_OK;  

-}

-

 const char * lynq_get_raw_data(Parcel* &p, int* data_len) 

 {

     int32_t len;

@@ -1305,6 +1271,136 @@
     return data;

 }

 

+int GetIntArrayInRespString(Parcel* &p, const char* tagString, int int_array_in_resp[MAX_AT_INT_RSP_NUM], int* valid_num)

+{

+    int bfind=false;

+    const char* data;

+    int data_len;

+    char* data_str;

+    char* start;

+    int length;

+    int i;

+    int num_start;

+    int ret=RESULT_OK;

+    int pos = p->dataPosition();

+    data = lynq_get_raw_data(p,&data_len);

+    p->setDataPosition(pos);

+    if(data==NULL || data_len == 0)

+    {

+        LYERRLOG("%s lynq_get_raw_data NULL or data_len is 0",__func__);          

+        return LYNQ_E_INNER_ERROR; 

+    }

+    data_str = (char*) calloc(1,data_len+1);

+    if (NULL == data_str) 

+    {

+        LYERRLOG("%s alloc mem error, data_len is %d",__func__,data_len+1);              

+        return LYNQ_E_MALLOC_ERROR;

+    }

+    memmove(data_str, data, data_len);     

+    data_str[data_len]='\0';           

+    LYINFLOG("%s return string is %s",__func__,data_str);  

+    start = strstr(data_str,tagString);

+    int local_valid_num=0;

+    if(start!=NULL)

+    {

+         start=start+strlen(tagString);

+         length=strlen(start);

+         for(i=0; i<length;i++)

+         {

+             if((!bfind) && (start[i] >= '0') && (start[i] <= '9'))

+             {

+                 bfind=true;  

+                 num_start=i;

+             }

+             else if(bfind && ((start[i] < '0') || (start[i] > '9')))

+             {

+                start[i]='\0';

+                int_array_in_resp[local_valid_num]=atoi(start+num_start);

+                local_valid_num++;

+                bfind=false;                

+             }             

+         }                

+    }           

+    else

+    {

+         LYERRLOG("%s  can't find tag string",__func__,tagString);         

+         ret=LYNQ_E_INNER_ERROR; 

+    }

+

+    if(local_valid_num ==0)

+    {

+         LYERRLOG("%s  can't find integer",__func__);                 

+    }

+    *valid_num = local_valid_num; 

+    LYINFLOG("%s ret is %d valid num is %d ",__func__,ret,*valid_num);  

+    free(data_str);

+    return ret;

+}

+

+int get_ret_code_for_hook(Parcel* &p)

+{

+    int ret;

+    int int_array_in_resp[MAX_AT_INT_RSP_NUM];

+    int valid_num;

+    

+    ret=GetIntArrayInRespString(p,"OK",int_array_in_resp,&valid_num);

+    

+    if(ret!=RESULT_OK)    

+    {

+        ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);

+        if(ret==RESULT_OK && valid_num > 0)

+        {

+            ret=int_array_in_resp[0];

+        }

+        else

+        {

+            ret=LYNQ_E_INNER_ERROR;

+        }

+    }

+    return ret;

+}

+

+int lynq_radio_on(const lynq_network_radio_on_type type)

+{     

+    if(g_module_init_flag != MODULE_RUNNING)

+    {

+        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

+        return LYNQ_E_CONFLICT;

+    }

+    if (type != NETWORK_RADIO_ON_TYPE_CFUN_0  && type != NETWORK_RADIO_ON_TYPE_NORMAL_MODE && type!=NETWORK_RADIO_ON_TYPE_FLIGHT_MODE)

+    {

+        LYERRLOG("%s parameter %d error",__func__,type);  

+        return LYNQ_E_PARAMETER_ANONALY;

+    }     

+    

+    Parcel* p=NULL;      

+    int ret;

+

+    if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)

+    {

+        ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+CFUN=0");

+    }

+    else 

+    {

+        ret=lynq_send_common_request(p,65,RIL_REQUEST_RADIO_POWER,1,"%d",(type==NETWORK_RADIO_ON_TYPE_NORMAL_MODE));

+    }

+

+    if(ret!=RESULT_OK)

+    {

+        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

+        return ret;  

+    }   

+

+    if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)

+    {

+        ret=get_ret_code_for_hook(p);    

+    }    

+

+    LYINFLOG("%s set %d ret is %d",__func__,type,ret);  

+    delete p;

+    return RESULT_OK;  

+}

+

 int lynq_query_radio_state(int *radio_state)

 {

     if(g_module_init_flag != MODULE_RUNNING)

@@ -1324,66 +1420,33 @@
     {

         LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

         return ret;  

-    }           

+    }         

 

-    int bfind=false;

-    const char* data;

-    int data_len;

-    char* data_str;

-    char* start;

-    int length;

-    int i;

-    int num_start;

-    data = lynq_get_raw_data(p,&data_len);

-    if(data==NULL || data_len == 0)

+    int int_array_in_resp[MAX_AT_INT_RSP_NUM];

+    int valid_num;

+

+    ret=GetIntArrayInRespString(p,"CFUN",int_array_in_resp,&valid_num);

+

+    if(ret==RESULT_OK && valid_num > 0)

     {

-        LYERRLOG("%s lynq_get_raw_data NULL or data_len is 0",__func__);    

-        delete p;

-        return LYNQ_E_INNER_ERROR; 

+        *radio_state=int_array_in_resp[0];

     }

-    data_str = (char*) calloc(1,data_len+1);

-    if (NULL == data_str) 

+    else 

     {

-         LYERRLOG("%s alloc mem error, data_len is %d",__func__,data_len+1);         

-         delete p;

-         return LYNQ_E_MALLOC_ERROR;

+        ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);

+        if(ret==RESULT_OK && valid_num > 0)

+        {

+            ret=int_array_in_resp[0];

+        }

+        else

+        {

+            ret=LYNQ_E_INNER_ERROR;

+        }

     }

-    memmove(data_str, data, data_len);     

-    data_str[data_len]='\0';           

-    LYINFLOG("%s return string is %s",__func__,data_str);  

-    start = strstr(data_str,"CFUN");

-    if(start!=NULL)

-    {

-         start=start+4;

-         length=strlen(start);

-         for(i=0; i<length;i++)

-         {

-             if((!bfind) && (start[i] >= '0') && (start[i] <= '9'))

-             {

-                 bfind=true;  

-                 num_start=i;

-             }

-             else if(bfind && ((start[i] < '0') || (start[i] > '9')))

-             {

-                start[i]='\0';

-                break;

-             }

-         }

-         if(bfind)

-         {                    

-             (*radio_state) = atoi(start+num_start);

-             LYINFLOG("%s, radio state is %s %d",__func__,start+num_start,*radio_state);  

-             free(data_str);

-             delete p;

-             return RESULT_OK;                         

-         }

-    }             

-    LYERRLOG("%s return string %s no cfun or no digit",__func__,data_str);  

-    free(data_str);

+    

     delete p;

-    return LYNQ_E_INNER_ERROR;              

-}

-

+    return ret;                

+} 

 int lynq_query_radio_tech(int* radioTech)

 {

     if(g_module_init_flag != MODULE_RUNNING)

@@ -1734,7 +1797,151 @@
     return RESULT_OK;   

 }

 

-#ifdef MODEM_GEN97

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+

+int lynq_set_oos_net_scan_cfg_fast(int t_fast_scan_enable,  int t_fast_scan_interval)

+{

+    if(! (

+               (t_fast_scan_enable==0) ||

+               (t_fast_scan_enable == 1 &&  

+                t_fast_scan_interval > 0 && t_fast_scan_interval <= 65535 )

+             )    )    

+        {

+            LYERRLOG("%s paramter %d %d error!",__func__, t_fast_scan_enable, t_fast_scan_interval);

+            return LYNQ_E_PARAMETER_ANONALY;

+        }

+    

+    Parcel* p=NULL;

+    int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s,%d,%d","AT+ZSET=\"FAST_FREQ_SCAN\"",t_fast_scan_enable,t_fast_scan_interval);

+

+    if(ret!=RESULT_OK)

+    {

+        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

+        return ret;  

+    }  

+

+    ret=get_ret_code_for_hook(p);    

+

+    LYINFLOG("%s %d %d ret is %d",__func__,t_fast_scan_enable,t_fast_scan_interval,ret);     

+    delete p;

+    return ret;  

+}

+

+int lynq_get_oos_net_scan_cfg_fast(int* t_fast_scan_enable,  int* t_fast_scan_interval)

+{    

+    Parcel* p=NULL;

+    int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+ZSET=\"FAST_FREQ_SCAN\"");

+

+    if(ret!=RESULT_OK)

+    {

+        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

+        return ret;  

+    }       

+    

+    int int_array_in_resp[MAX_AT_INT_RSP_NUM];

+    int valid_num;

+

+    ret=GetIntArrayInRespString(p,"FAST_FREQ_SCAN",int_array_in_resp,&valid_num);

+

+    if(ret==RESULT_OK && valid_num > 1)

+    {

+        *t_fast_scan_enable = int_array_in_resp[0];

+        *t_fast_scan_interval = int_array_in_resp[1];        

+    }

+    else 

+    {

+        ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);

+        if(ret==RESULT_OK && valid_num > 0)

+        {

+            ret=int_array_in_resp[0];

+        }

+        else

+        {

+            ret=LYNQ_E_INNER_ERROR;

+        }

+    }

+    

+    delete p;

+    return ret;                

+}

+

+

+int lynq_set_oos_net_scan_cfg_full_band(int t_full_band_min, int t_full_band_step, int t_full_band_num, int t_full_band_max)

+{      

+    if(! (

+           (t_full_band_min==0 && t_full_band_step ==0  && t_full_band_num ==0 && t_full_band_max ==0) ||

+           (t_full_band_min > 0 && t_full_band_min <= 65535 && 

+            t_full_band_step > 0 && t_full_band_step <= 65535 && 

+            t_full_band_num > 0 && t_full_band_num <= 65535 && 

+            t_full_band_max > 0 && t_full_band_max <= 65535 )

+         )    )  

+    {

+        LYERRLOG("%s paramter  %d %d %d %d error!",__func__, t_full_band_min, t_full_band_step, t_full_band_num, t_full_band_max);

+        return LYNQ_E_PARAMETER_ANONALY;

+    }

+

+    Parcel* p=NULL;

+    int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s,%d,%d,%d,%d","AT+ZSET=\"FREQ_SCAN\"",t_full_band_min,t_full_band_step,t_full_band_num,t_full_band_max);

+

+    if(ret!=RESULT_OK)

+    {

+        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

+        return ret;  

+    }     

+

+    ret=get_ret_code_for_hook(p);    

+

+    LYINFLOG("%s %d %d %d %d ret is %d",__func__,t_full_band_min,t_full_band_step,t_full_band_num,t_full_band_max,ret);     

+    delete p;

+    return ret;      

+}

+

+int lynq_get_oos_net_scan_cfg_full_band(int* t_full_band_min, int* t_full_band_step, int* t_full_band_num, int* t_full_band_max)

+{    

+    Parcel* p=NULL;

+    int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+ZSET=\"FREQ_SCAN\"");

+

+    if(ret!=RESULT_OK)

+    {

+        LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

+        return ret;  

+    }       

+    

+    int int_array_in_resp[MAX_AT_INT_RSP_NUM];

+    int valid_num;

+

+    ret=GetIntArrayInRespString(p,"FREQ_SCAN",int_array_in_resp,&valid_num);

+

+    if(ret==RESULT_OK && valid_num > 1)

+    {

+        *t_full_band_min = int_array_in_resp[0];

+        *t_full_band_step = int_array_in_resp[1];

+        *t_full_band_num = int_array_in_resp[2];

+        *t_full_band_max = int_array_in_resp[3];        

+    }

+    else 

+    {

+        ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);

+        if(ret==RESULT_OK && valid_num > 0)

+        {

+            ret=int_array_in_resp[0];

+        }

+        else

+        {

+            ret=LYNQ_E_INNER_ERROR;

+        }

+    }

+

+    LYINFLOG("%s ret is %d",__func__,ret);  

+    delete p;

+    return ret;                

+}

+

+

+#define OOS_NET_SCAN_CFG_TYPE_FAST 0

+#define OOS_NET_SCAN_CFG_TYPE_FULL_BAND 1

+

+#elif defined(MODEM_GEN97) 

 /**@brief parse at response,return error code,and the response

 * @param response [IN] <response>:original at response,This parameter must be a character array.

 

@@ -1959,7 +2166,98 @@
  

 }

 

-DEFINE_LYNQ_LIB_LOG(LYNQ_NETWORK)

+#endif

+

+#if (defined MOBILETEK_TARGET_PLATFORM_T106) || (defined MODEM_GEN97)

+

+int lynq_set_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int valid_num)

+{

+    if(g_module_init_flag != MODULE_RUNNING)

+    {

+        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

+        return LYNQ_E_CONFLICT;

+    }

+

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+    if(valid_num < 1)

+    {

+        LYERRLOG("%s paramter valid_num  %d error!",__func__,valid_num);

+        return LYNQ_E_PARAMETER_ANONALY;

+    }

+

+    if(config_list[0] == OOS_NET_SCAN_CFG_TYPE_FAST)  

+    {

+        if(valid_num <3 )

+        {            

+            LYERRLOG("%s paramter valid_num %d error!",__func__, valid_num);

+            return LYNQ_E_PARAMETER_ANONALY;

+        }        

+        return lynq_set_oos_net_scan_cfg_fast(config_list[1],config_list[2]);

+    }        

+    else if (config_list[0] == OOS_NET_SCAN_CFG_TYPE_FULL_BAND)

+    {

+        if(valid_num <5 )

+        {

+            

+            LYERRLOG("%s paramter valid_num %d error!",__func__, valid_num);

+            return LYNQ_E_PARAMETER_ANONALY;

+        }        

+        return lynq_set_oos_net_scan_cfg_full_band(config_list[1],config_list[2],config_list[3],config_list[4]);

+    }

+    else 

+    {

+        LYERRLOG("%s paramter type %d error!",__func__, config_list[0]);

+        return LYNQ_E_PARAMETER_ANONALY;

+    }     

+

+#else

+    if(valid_num < 4)

+    {

+        LYERRLOG("%s paramter valid_num  %d error!",__func__,valid_num);

+        return LYNQ_E_PARAMETER_ANONALY;

+    }

+    return lynq_oos_deep_sleep_recover_timer_interval(config_list[0],config_list[1],config_list[2],config_list[3]);   

+#endif    

+}

+

+

+int lynq_get_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int* valid_num)

+{

+    if(g_module_init_flag != MODULE_RUNNING)

+    {

+        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

+        return LYNQ_E_CONFLICT;

+    }

+

+#ifdef MOBILETEK_TARGET_PLATFORM_T106   

+

+    if(NULL == valid_num || NULL == config_list)

+    {

+          LYERRLOG("%s there is parameter is NULL",__func__);  

+          return LYNQ_E_PARAMETER_ANONALY;

+    }      

+      

+

+    if(config_list[0] == OOS_NET_SCAN_CFG_TYPE_FAST)  

+    {

+        *valid_num=2;

+        return lynq_get_oos_net_scan_cfg_fast(&(config_list[0]),&(config_list[1]));

+    }        

+    else if (config_list[0] == OOS_NET_SCAN_CFG_TYPE_FULL_BAND)

+    {

+         *valid_num=4;

+         return lynq_get_oos_net_scan_cfg_full_band(&(config_list[0]),&(config_list[1]),&(config_list[2]),&(config_list[3]));

+    }

+    else 

+    {

+        LYERRLOG("%s paramter type %d error!",__func__, config_list[0]);

+        return LYNQ_E_PARAMETER_ANONALY;

+    }           

+#else    

+    return LYNQ_E_PARAMETER_ANONALY;

+#endif    

+}

 

 #endif

 

+DEFINE_LYNQ_LIB_LOG(LYNQ_NETWORK)

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile
index cf6f538..5505037 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile
@@ -15,6 +15,9 @@
 LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
 endif
 
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+    LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+endif
 $(warning ################# lynq network demo ROOT: $(ROOT),includedir:$(includedir))
 LOCAL_PATH   = .
 
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
index b65e428..0e571fa 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
@@ -35,6 +35,35 @@
     E_QSER_NW_ROAM_STATE_TYPE_T   roaming_pref;       /**<   Roaming preference.*/
 }QSER_NW_CONFIG_INFO_T;
 
+/** Configures the OOS (out of service)  settings that define the MCM network interface. */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN          0x00    /**<  fast net scan */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN     0x01    /**<  full band scan */
+
+typedef struct 
+{
+    /*    Configuration parameters for MCM network fast network scan when OOS (out of service)*/
+    char                        enable;
+    uint16_t                    time_interval;
+}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
+
+typedef struct 
+{
+    /*    Configuration parameters for MCM network full band network scan when OOS (out of service)*/
+    int t_min;
+    int t_step;
+    int t_num;
+    int t_max;
+}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
+
+
+typedef struct 
+{    
+    char                        type;  /**<   QSER_NW_OOS_CFG_TYPE_xxxx.*/
+    union {
+    QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T  fast_can_info;       // 00
+    QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info;     // 01   
+  } u;
+}QSER_NW_OOS_CONFIG_INFO_T;
 
 //defined for QSER_NW_EventRegister
 #define     NW_IND_VOICE_REG_EVENT_IND_FLAG               (1 << 0)    /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
@@ -346,6 +375,18 @@
     QSER_NW_CONFIG_INFO_T     *pt_info 
 );
 
+int qser_nw_set_oos_config
+(
+    nw_client_handle_type       h_nw,
+    QSER_NW_OOS_CONFIG_INFO_T     *pt_info 
+);
+
+int qser_nw_get_oos_config
+(
+    nw_client_handle_type       h_nw,
+    QSER_NW_OOS_CONFIG_INFO_T     *pt_info 
+);
+
 int qser_nw_event_register
 (
     nw_client_handle_type       h_nw,
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
index 0a32515..b1539a7 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
@@ -273,6 +273,101 @@
     return RESULT_OK;
 }
 
+int qser_nw_set_oos_config(    nw_client_handle_type       h_nw,QSER_NW_OOS_CONFIG_INFO_T     *pt_info
+)
+{
+    if(NULL == pt_info)
+     {
+         LYERRLOG("invalid client parameters incoming");
+         return RESULT_ERROR;
+     }
+     
+     if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)
+     {
+         LYERRLOG("h_nw not right %d %d",h_nw,g_ph_hw);
+         return RESULT_ERROR;
+     }    
+
+     int config_list[MAX_OOS_CFG_ITEM_NUMBER];
+     int valid_num;
+
+     if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+     {
+         config_list[0]=QSER_NW_OOS_CFG_TYPE_FAST_SCAN;
+         config_list[1]=pt_info->u.fast_can_info.enable;
+         config_list[2]=pt_info->u.fast_can_info.time_interval;
+         return lynq_set_oos_net_scan_cfg(config_list, 3);
+     }
+     else if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+     {
+         config_list[0]=QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;
+         config_list[1]=pt_info->u.full_band_scan_info.t_min;
+         config_list[2]=pt_info->u.full_band_scan_info.t_step;
+         config_list[3]=pt_info->u.full_band_scan_info.t_num;
+         config_list[4]=pt_info->u.full_band_scan_info.t_max;
+         return lynq_set_oos_net_scan_cfg(config_list, 5);
+     }
+     else
+     {
+        LYERRLOG("invalid client parameters %d incoming", pt_info->type);
+        return RESULT_ERROR;
+     }     
+}
+
+int qser_nw_get_oos_config(    nw_client_handle_type   h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info)
+{
+    if(NULL == pt_info)
+    {
+        LYERRLOG("invalid client parameters incoming");
+        return RESULT_ERROR;
+    }
+    
+    if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)
+    {
+        LYERRLOG("h_nw not right %d %d",h_nw,g_ph_hw);
+        return RESULT_ERROR;
+    }  
+
+    int config_list[MAX_OOS_CFG_ITEM_NUMBER];
+    int valid_num;
+    int ret;
+
+    if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+    {
+        config_list[0]=QSER_NW_OOS_CFG_TYPE_FAST_SCAN;        
+        ret=lynq_get_oos_net_scan_cfg(config_list, &valid_num);
+        if(ret==RESULT_OK || valid_num > 1)
+        {
+            pt_info->u.fast_can_info.enable=config_list[0];
+            pt_info->u.fast_can_info.time_interval=config_list[1];
+            return RESULT_OK;
+        }
+        LYERRLOG("type %d invalid return value %d %d",pt_info->type,ret,valid_num);
+        return RESULT_ERROR;         
+     }
+     else if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+     {
+         config_list[0]=QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;        
+         ret=lynq_get_oos_net_scan_cfg(config_list, &valid_num);
+         if(ret==RESULT_OK || valid_num > 3)
+         {
+             pt_info->u.full_band_scan_info.t_min=config_list[0];
+             pt_info->u.full_band_scan_info.t_step=config_list[1];            
+             pt_info->u.full_band_scan_info.t_num=config_list[2];
+             pt_info->u.full_band_scan_info.t_max=config_list[3];
+             return RESULT_OK;
+         }
+         LYERRLOG("type %d invalid return value %d %d",pt_info->type,ret,valid_num);
+         return RESULT_ERROR;        
+     }
+     else
+     {
+        LYERRLOG("invalid client parameters %d incoming", pt_info->type);
+        return RESULT_ERROR;
+     }     
+    
+}
+
 /*To Do*/
 int qser_nw_event_register(nw_client_handle_type h_nw,uint32_t bitmask)
 {