[DA patch]Add timeout configuration 42/284242/3 accepted/tizen/7.0/unified/20221207.014410
authorjiung-yu <jiung.yu@samsung.com>
Mon, 14 Nov 2022 07:00:13 +0000 (16:00 +0900)
committerjiung-yu <jiung.yu@samsung.com>
Tue, 15 Nov 2022 02:25:09 +0000 (11:25 +0900)
Change-Id: I6b0f82889cb4fc08192e22d185d2d13e28c063f9
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
14 files changed:
files/wifi-direct-manager.conf.common
files/wifi-direct-manager.conf.in
files/wifi-direct-manager.conf.mobile
files/wifi-direct-manager.conf.tm1
files/wifi-direct-manager.conf.tv
files/wifi-direct-manager.conf.wearable
include/wifi-direct-manager.h
include/wifi-direct-session.h
include/wifi-direct-util.h
oem/wifi-direct-oem.h
packaging/wifi-direct-manager.spec
src/wifi-direct-manager.c
src/wifi-direct-session.c
src/wifi-direct-util.c

index 02ac068..9f9b5fc 100644 (file)
@@ -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
index 02ac068..e597fb3 100644 (file)
@@ -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
index e67d32c..a5b400f 100644 (file)
@@ -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
index 3e23cfd..e100938 100644 (file)
@@ -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
index 978f9f2..be9e556 100644 (file)
@@ -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
index 61e9527..339a891 100644 (file)
@@ -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
index 7433baa..73067b9 100644 (file)
@@ -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;
index b563491..13d38ec 100644 (file)
@@ -58,6 +58,7 @@ typedef enum {
 typedef struct {
        int type;
        int state;
+       int timeout;
        int timer;
        int connecting_120;
        unsigned int retry_gsrc;
index 2269900..5ce735e 100644 (file)
@@ -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);
index 60be73c..4f49fab 100644 (file)
@@ -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 {
index 3e75ea0..e8f3320 100644 (file)
@@ -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
index a9042dd..a5bdb82 100644 (file)
@@ -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();
 
index 52c046c..e66601c 100644 (file)
@@ -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;
 }
index b01a532..31ee6ac 100644 (file)
@@ -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)