Support 6GHz band for channels and RSSI level 96/299096/1 accepted/tizen_8.0_unified accepted/tizen/8.0/unified/20231005.093228 accepted/tizen/unified/20230920.161457 tizen_8.0_m2_release
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 19 Sep 2023 13:26:50 +0000 (22:26 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 19 Sep 2023 13:26:50 +0000 (22:26 +0900)
Change-Id: I4fa37274dc1a50c7bd659f494339c6fcdffb076a
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/utils/util.c
src/wifi-indicator.c

index f790a32..7eddea2 100755 (executable)
@@ -1508,12 +1508,19 @@ char *netconfig_get_default_ifname_from_file(void)
 
 int netconfig_freq_to_channel(int freq)
 {
-       if (freq < 2412 || freq > 5825 ||
-               (freq > 2484 && freq < 5180)) {
+       /*
+        * 5825 is max frequency for 5 GHz and 7125 is for 6 GHz
+        */
+       if (freq < 2412 || freq > 7125 ||
+                       (freq > 2484 && freq < 5180) ||
+                       (freq > 5825 && freq < 5945)) {
                ERR("Invalid Frequence Range");
                return 0;
        }
-       if (freq >= 5180)
+
+       if (freq >= 5945)
+               return 189 + (freq - 5945)/5;
+       else if (freq >= 5180)
                return 36 + (freq - 5180)/5;
        else if (freq <= 2472)
                return 1 + (freq - 2412)/5;
@@ -1538,8 +1545,11 @@ int netconfig_get_operating_class(int freq)
                else if (channel >= 36 && channel <= 48)
                        oper_class = 115;
                /* Operating class 124 - 5 GHz, channels 149,153,157,161 */
-               else
+               else if (channel >= 149 && channel <= 161)
                        oper_class = 124;
+               /* Operating class - 6 GHz, channels 189, 193, 197, ... 425 */
+               else if (channel >= 189 && channel <= 425)
+                       oper_class = 131;
 
                INFO("Operating Class  is [%d]", oper_class);
                return oper_class;
index 06ac9da..927654a 100755 (executable)
@@ -171,6 +171,33 @@ static int __netconfig_wifi_convert_dbm_to_level_50(int rssi_dbm)
        return rssi_level;
 }
 
+static int __netconfig_wifi_convert_dbm_to_level_60(int rssi_dbm)
+{
+       int rssi_level = 0;
+
+       /* Wi-Fi Signal Strength Display (for 6G (dB))
+        *
+        * Excellent :     ~ -72
+        * Good      : -73 ~ -77
+        * Weak      : -78 ~ -82
+        * Very weak : -83 ~ -88
+        * No signal : -89 ~
+        */
+
+       if (rssi_dbm >= -72)
+               rssi_level = 4;
+       else if (rssi_dbm >= -77)
+               rssi_level = 3;
+       else if (rssi_dbm >= -82)
+               rssi_level = 2;
+       else if (rssi_dbm >= -88)
+               rssi_level = 1;
+       else
+               rssi_level = 0;
+
+       return rssi_level;
+}
+
 static int __netconfig_wifi_get_rssi_level(const int rssi_dbm)
 {
        int snr_level = 0;
@@ -179,7 +206,9 @@ static int __netconfig_wifi_get_rssi_level(const int rssi_dbm)
 
        ret = netconfig_vconf_get_int("memory/private/wifi/frequency", &freq);
 
-       if (!ret && freq > 4900)
+       if (!ret && freq > 5925)
+               snr_level = __netconfig_wifi_convert_dbm_to_level_60(rssi_dbm);
+       else if (!ret && freq > 4900)
                snr_level = __netconfig_wifi_convert_dbm_to_level_50(rssi_dbm);
        else
                snr_level = __netconfig_wifi_convert_dbm_to_level_24(rssi_dbm);