[Bugfix][T106][task-view-394] add interface: qser_nw_get_config
Only Configure: No
Affected branch: unknown
Affected module: network
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: yes
Doc Update: yes
Change-Id: Ia381273efd1ebe5a47d2f388f0a476aaf1c6b376
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 ad38820..2d45d7d 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
@@ -17,6 +17,7 @@
int (*qser_nw_client_init_p)(nw_client_handle_type * ph_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_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 );
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);
@@ -44,6 +45,7 @@
qser_nw_client_init_p = (int (*)(nw_client_handle_type * ph_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_config_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_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");
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");
@@ -55,7 +57,7 @@
qser_nw_set_ims_enable_p = (int (*)(nw_client_handle_type h_nw, E_QSER_NW_IMS_MODE_TYPE_T ims_mode))dlsym(handle_network,"qser_nw_set_ims_enable");
qser_nw_get_ims_reg_status_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_IMS_REG_STATUS_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_ims_reg_status");
- if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL ||
+ if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL || qser_nw_get_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 ||
qser_nw_set_rf_mode_p == NULL || qser_nw_get_rf_mode_p == NULL || qser_nw_get_oos_config_p == NULL || qser_nw_set_oos_config_p == NULL ||
qser_nw_set_ims_enable_p == NULL || qser_nw_get_ims_reg_status_p == NULL)
@@ -100,7 +102,8 @@
{9, "qser_nw_get_rf_mode"},
{10, "qser_nw_set_ims_enable"},
{11, "qser_nw_get_ims_reg_status"},
- {12, "qser_nw_client_deinit"},
+ {12, "qser_nw_get_config"},
+ {13, "qser_nw_client_deinit"},
{-1, "quit"}
};
@@ -452,7 +455,7 @@
break;
}
- case 12://"qser_nw_client_deinit"
+ case 13://"qser_nw_client_deinit"
{
ret = qser_nw_client_deinit_p(h_nw);
printf("qser_nw_client_deinit ret = %d\n", ret);
@@ -610,7 +613,14 @@
t_info.registration_state);
}
break;
- }
+ }
+ case 12://"qser_nw_get_config"
+ {
+ QSER_NW_CONFIG_INFO_T t_info = {0};
+ ret = qser_nw_get_config_p(h_nw, &t_info);
+ printf("qser_nw_get_config ret = %d\n, nw_mode is %llu", ret,t_info.preferred_nw_mode);
+ 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 56e2ce0..aee4285 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
@@ -401,6 +401,12 @@
QSER_NW_CONFIG_INFO_T *pt_info
);
+int qser_nw_get_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_CONFIG_INFO_T *pt_info
+);
+
int qser_nw_set_ims_enable
(
nw_client_handle_type h_nw,
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 dcfb9b7..b5abbc7 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
@@ -401,6 +401,12 @@
QSER_NW_CONFIG_INFO_T *pt_info
);
+int qser_nw_get_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_CONFIG_INFO_T *pt_info
+);
+
int qser_nw_set_ims_enable
(
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 6d211d9..82a1b8f 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
@@ -60,7 +60,7 @@
} RIL_PreferredNetworkType;
#endif
-int switch_preferred_nw_mode(const uint64_t preferred_nw_mode)
+int switch_preferred_nw_mode(const uint64_t preferred_nw_mode, int dir)
{
uint32_t map[23]={
0xffff, //PREF_NET_TYPE_GSM_WCDMA = 0, /* GSM/WCDMA (WCDMA preferred) */
@@ -87,16 +87,34 @@
QSER_NW_MODE_TDSCDMA | QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA | QSER_NW_MODE_CDMA | QSER_NW_MODE_EVDO, //PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO = 21, /* TD-SCDMA, GSM/WCDMA, CDMA and EvDo */
QSER_NW_MODE_TDSCDMA | QSER_NW_MODE_LTE | QSER_NW_MODE_CDMA |QSER_NW_MODE_EVDO | QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA, //PREF_NET_TYPE_TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA = 22, /* TD-SCDMA, LTE, CDMA, EvDo GSM/WCDMA */
};
- int array_length=sizeof (map)/ sizeof (map[0]);
- for(int i=1;i<array_length;i++)
- {
- if(map[i]==preferred_nw_mode)
- {
- return i;
- }
+ int array_length = sizeof (map)/ sizeof (map[0]);
+
+ if(dir==0)
+ {
+ for(int i=1;i<array_length;i++)
+ {
+ if(map[i]==preferred_nw_mode)
+ {
+ return i;
+ }
+ }
}
-
+ else
+ {
+ if(preferred_nw_mode < array_length)
+ {
+ if(preferred_nw_mode!=0)
+ {
+ return map[preferred_nw_mode];
+ }
+ else
+ {
+ /*0 respond to gsm and wcdma, prefer wcdma*/
+ return (QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA);
+ }
+ }
+ }
return INVALID_PREFER_TYPE;
}
@@ -256,7 +274,7 @@
LYINFLOG("pthread join waiting urc thread ret = %d",ret);
s_new_network_tid =-1;
}
-
+
s_handlerPtr=NULL;
s_contextPtr=NULL;
@@ -288,7 +306,7 @@
return RESULT_ERROR;
}
- pretype = switch_preferred_nw_mode(pt_info->preferred_nw_mode);
+ pretype = switch_preferred_nw_mode(pt_info->preferred_nw_mode,0);
if (pretype ==INVALID_PREFER_TYPE)
{
LYERRLOG("invalid client parameters incoming %d",pt_info->preferred_nw_mode);
@@ -304,6 +322,38 @@
return RESULT_OK;
}
+int qser_nw_get_config(nw_client_handle_type h_nw, QSER_NW_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 pretype;
+ int ret = lynq_query_prefferred_networktype(&pretype);
+ if (ret != RESULT_OK)
+ {
+ LYERRLOG("lynq_get_prefferred_networktype failed ret is %d",ret);
+ return RESULT_ERROR;
+ }
+
+ int preferred_nw_mode = switch_preferred_nw_mode(pretype,1);
+ if (preferred_nw_mode ==INVALID_PREFER_TYPE)
+ {
+ LYERRLOG("invalid pretype %d",pretype);
+ return RESULT_ERROR;
+ }
+ pt_info->preferred_nw_mode=preferred_nw_mode;
+ return RESULT_OK;
+}
+
+
int qser_nw_set_ims_enable(nw_client_handle_type h_nw,E_QSER_NW_IMS_MODE_TYPE_T ims_mode)
{
if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)