From: jiung-yu Date: Mon, 14 Nov 2022 07:00:13 +0000 (+0900) Subject: [DA patch]Add timeout configuration X-Git-Tag: accepted/tizen/7.0/unified/20221207.014410^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fwifi-direct-manager.git;a=commitdiff_plain;h=102778c1b0d5f1d5d6428bb83dbd96d06975410c [DA patch]Add timeout configuration Change-Id: I6b0f82889cb4fc08192e22d185d2d13e28c063f9 Signed-off-by: Yu jiung --- diff --git a/files/wifi-direct-manager.conf.common b/files/wifi-direct-manager.conf.common index 02ac068..9f9b5fc 100644 --- a/files/wifi-direct-manager.conf.common +++ b/files/wifi-direct-manager.conf.common @@ -32,3 +32,5 @@ config_methods=display push_button keypad p2ps no_group_iface=0 # Group operating frequency group_operating_freq=0 +# Connection Timeout +connection_timeout=120 \ No newline at end of file diff --git a/files/wifi-direct-manager.conf.in b/files/wifi-direct-manager.conf.in index 02ac068..e597fb3 100644 --- a/files/wifi-direct-manager.conf.in +++ b/files/wifi-direct-manager.conf.in @@ -32,3 +32,5 @@ config_methods=display push_button keypad p2ps no_group_iface=0 # Group operating frequency group_operating_freq=0 +# Connection Timeout +connection_timeout=120 diff --git a/files/wifi-direct-manager.conf.mobile b/files/wifi-direct-manager.conf.mobile index e67d32c..a5b400f 100644 --- a/files/wifi-direct-manager.conf.mobile +++ b/files/wifi-direct-manager.conf.mobile @@ -33,3 +33,5 @@ config_methods=display push_button keypad p2ps no_group_iface=0 # Group operating frequency group_operating_freq=0 +# Connection Timeout +connection_timeout=120 diff --git a/files/wifi-direct-manager.conf.tm1 b/files/wifi-direct-manager.conf.tm1 index 3e23cfd..e100938 100644 --- a/files/wifi-direct-manager.conf.tm1 +++ b/files/wifi-direct-manager.conf.tm1 @@ -33,3 +33,5 @@ config_methods=display push_button keypad p2ps no_group_iface=1 # Group operating frequency group_operating_freq=0 +# Connection Timeout +connection_timeout=120 diff --git a/files/wifi-direct-manager.conf.tv b/files/wifi-direct-manager.conf.tv index 978f9f2..be9e556 100644 --- a/files/wifi-direct-manager.conf.tv +++ b/files/wifi-direct-manager.conf.tv @@ -33,3 +33,5 @@ config_methods=keypad virtual_push_button physical_display no_group_iface=1 # Group operating frequency group_operating_freq=0 +# Connection Timeout +connection_timeout=120 diff --git a/files/wifi-direct-manager.conf.wearable b/files/wifi-direct-manager.conf.wearable index 61e9527..339a891 100644 --- a/files/wifi-direct-manager.conf.wearable +++ b/files/wifi-direct-manager.conf.wearable @@ -33,3 +33,5 @@ config_methods=display push_button keypad p2ps no_group_iface=0 # Group operating frequency group_operating_freq=0 +# Connection Timeout +connection_timeout=120 diff --git a/include/wifi-direct-manager.h b/include/wifi-direct-manager.h index 7433baa..73067b9 100644 --- a/include/wifi-direct-manager.h +++ b/include/wifi-direct-manager.h @@ -175,6 +175,7 @@ typedef struct { int session_timer; int go_intent_per_type[WFD_MAX_TYPE]; + int connection_timeout; gboolean auto_group_remove_enable; gboolean is_on_demand_supported; gboolean is_service_discovery_supported; diff --git a/include/wifi-direct-session.h b/include/wifi-direct-session.h index b563491..13d38ec 100644 --- a/include/wifi-direct-session.h +++ b/include/wifi-direct-session.h @@ -58,6 +58,7 @@ typedef enum { typedef struct { int type; int state; + int timeout; int timer; int connecting_120; unsigned int retry_gsrc; diff --git a/include/wifi-direct-util.h b/include/wifi-direct-util.h index 2269900..5ce735e 100644 --- a/include/wifi-direct-util.h +++ b/include/wifi-direct-util.h @@ -65,7 +65,6 @@ int wfd_util_channel_to_freq(int channel); int wfd_util_get_phone_name(char *phone_name); void wfd_util_set_dev_name_notification(); void wfd_util_unset_dev_name_notification(); -int wfd_util_set_country(); void wfd_util_check_features(wfd_manager_s *manager); void wfd_util_load_wfd_conf(wfd_manager_s *manager); diff --git a/oem/wifi-direct-oem.h b/oem/wifi-direct-oem.h index 60be73c..4f49fab 100644 --- a/oem/wifi-direct-oem.h +++ b/oem/wifi-direct-oem.h @@ -54,6 +54,7 @@ extern "C" { #define DEFAULT_OPER_CHANNEL 1 #define DEFAULT_CONFIG_METHOD "display push_button keypad p2ps" #define DEFAULT_NO_GROUP_IFACE 0 +#define DEFAULT_CONNECTION_TIMEOUT 120 #define OEM_MACSTR_LEN 18 #define OEM_MACADDR_LEN 6 @@ -212,6 +213,7 @@ typedef struct { char config_methods[OEM_CONFIG_METHOD_LEN+1]; gboolean no_group_iface; int group_operating_freq; + int connection_timeout; } wfd_oem_config_s; typedef struct { diff --git a/packaging/wifi-direct-manager.spec b/packaging/wifi-direct-manager.spec index 3e75ea0..e8f3320 100644 --- a/packaging/wifi-direct-manager.spec +++ b/packaging/wifi-direct-manager.spec @@ -6,7 +6,7 @@ Name: wifi-direct-manager Summary: Wi-Fi Direct manger -Version: 1.3.8 +Version: 1.3.9 Release: 1 Group: Network & Connectivity/Wireless License: Apache-2.0 diff --git a/src/wifi-direct-manager.c b/src/wifi-direct-manager.c index a9042dd..a5bdb82 100644 --- a/src/wifi-direct-manager.c +++ b/src/wifi-direct-manager.c @@ -671,7 +671,6 @@ int wfd_manager_activate(wfd_manager_s *manager) wfd_util_set_wifi_direct_state(WIFI_DIRECT_STATE_ACTIVATED); wfd_manager_local_config_set(manager); - wfd_util_set_country(); if (manager->is_connection_agent) wfd_util_start_wifi_direct_popup(); diff --git a/src/wifi-direct-session.c b/src/wifi-direct-session.c index 52c046c..e66601c 100644 --- a/src/wifi-direct-session.c +++ b/src/wifi-direct-session.c @@ -162,7 +162,7 @@ int wfd_session_timer(wfd_session_s *session, int start) __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE return -1; } - session->timer = g_timeout_add(120000, + session->timer = g_timeout_add_seconds(session->timeout, (GSourceFunc) _session_timeout_cb, NULL); WDS_LOGD("Session timer started");//LCOV_EXCL_LINE @@ -256,6 +256,7 @@ wfd_session_s *wfd_create_session(void *data, unsigned char *peer_addr, int wps_ if (peer->dev_role == WFD_DEV_ROLE_GO && manager->local->dev_role != WFD_DEV_ROLE_GO) manager->local->dev_role = WFD_DEV_ROLE_GC; + session->timeout = manager->connection_timeout; __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE return session; } diff --git a/src/wifi-direct-util.c b/src/wifi-direct-util.c index b01a532..31ee6ac 100644 --- a/src/wifi-direct-util.c +++ b/src/wifi-direct-util.c @@ -106,6 +106,7 @@ enum wfd_util_conf_key { WFD_CONF_CONFIG_METHOD, WFD_CONF_NO_GROUP_IFACE, WFD_CONF_GROUP_OPER_FREQ, + WFD_CONF_CONNECTION_TIMEOUT, WFD_CONF_MAX, }; @@ -162,7 +163,8 @@ static void __load_wfd_config(GKeyFile **key_file, struct key_value *conf_key_va (!g_strcmp0(conf_key_val[i].key, "listen_channel")) || (!g_strcmp0(conf_key_val[i].key, "operating_reg_class")) || (!g_strcmp0(conf_key_val[i].key, "operating_channel")) || - (!g_strcmp0(conf_key_val[i].key, "group_operating_freq"))) { + (!g_strcmp0(conf_key_val[i].key, "group_operating_freq")) || + (!g_strcmp0(conf_key_val[i].key, "connection_timeout"))) { conf_key_val[i].int_value = g_key_file_get_integer(result, WFD_CONF_GROUP_NAME, conf_key_val[i].key, &error); @@ -431,6 +433,7 @@ void wfd_util_load_wfd_conf(wfd_manager_s * manager) {WFD_CONF_CONFIG_METHOD, "config_methods", NULL, 0, FALSE}, {WFD_CONF_NO_GROUP_IFACE, "no_group_iface", NULL, 0, FALSE}, {WFD_CONF_GROUP_OPER_FREQ, "group_operating_freq", NULL, 0, FALSE}, + {WFD_CONF_CONNECTION_TIMEOUT, "connection_timeout", NULL, 0, FALSE}, {WFD_CONF_MAX, NULL, NULL, 0, FALSE}, }; @@ -551,6 +554,11 @@ void wfd_util_load_wfd_conf(wfd_manager_s * manager) else oem_conf->group_operating_freq = 0; + if (wfd_conf[WFD_CONF_CONNECTION_TIMEOUT].int_value > 0) + manager->connection_timeout = wfd_conf[WFD_CONF_CONNECTION_TIMEOUT].int_value; + else + manager->connection_timeout = DEFAULT_CONNECTION_TIMEOUT; + __unload_wfd_config(key_file, wfd_conf); __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE @@ -797,61 +805,6 @@ void wfd_util_unset_dev_name_notification() return; } -void _wfd_util_check_country_cb(keynode_t *key, void *data) -{ - __WDS_LOG_FUNC_ENTER__;//LCOV_EXCL_LINE - wfd_manager_s *manager = (wfd_manager_s*) data; - int res = 0; - int plmn = 0; - char mcc[4] = {0, }; - char *ccode; - GKeyFile *keyfile = NULL; - const char *file_path = COUNTRY_CODE_FILE; - GError *err = NULL; - - if (!manager) { - WDS_LOGE("Invalid parameter"); - return; - } - - res = vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn); - if (res) { - WDS_LOGE("Failed to get vconf value for PLMN(%d)", res); - return; - } - - snprintf(mcc, 4, "%d", plmn); - - keyfile = g_key_file_new(); - res = g_key_file_load_from_file(keyfile, file_path, 0, &err); - if (!res) { - WDS_LOGE("Failed to load key file(%s)", err->message); - g_key_file_free(keyfile); - g_error_free(err); - return; - } - - ccode = g_key_file_get_string(keyfile, "ccode_map", mcc, &err); - if (!ccode) { - WDS_LOGE("Failed to get country code string(%s)", err->message); - g_key_file_free(keyfile); - g_error_free(err); - return; - } - - res = wfd_oem_set_country(manager->oem_ops, ccode); - if (res < 0) - WDS_LOGE("Failed to set contry code"); - else - WDS_LOGD("Succeeded to set country code(%s)", ccode); - - g_key_file_free(keyfile); - g_free(ccode); - - __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE - return; -} - int wfd_util_check_wifi_state() { __WDS_LOG_FUNC_ENTER__;//LCOV_EXCL_LINE @@ -914,38 +867,6 @@ int wfd_util_check_mobile_ap_state() } //LCOV_EXCL_STOP -int wfd_util_set_country() -{ - __WDS_LOG_FUNC_ENTER__;//LCOV_EXCL_LINE - wfd_manager_s *manager = wfd_get_manager(); - int res = 0; - - _wfd_util_check_country_cb(NULL, manager); - - res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_PLMN, _wfd_util_check_country_cb, manager); - if (res) { - WDS_LOGE("Failed to set vconf notification callback(TELEPHONY_PLMN)"); - return -1; - } - - __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE - return 0; -} - -int wfd_util_unset_country() -{ - __WDS_LOG_FUNC_ENTER__;//LCOV_EXCL_LINE - int res = 0; - - res = vconf_ignore_key_changed(VCONFKEY_TELEPHONY_PLMN, _wfd_util_check_country_cb); - if (res) { - WDS_LOGE("Failed to unset vconf notification callback(TELEPHONY_PLMN)"); - return -1; - } - - __WDS_LOG_FUNC_EXIT__;//LCOV_EXCL_LINE - return 0; -} static void __check_feature_supported(const char *key, bool *feature_supported)