Merge "Use the default logic when not using INS" into tizen
[platform/upstream/connman.git] / gsupplicant / supplicant.c
index fe1b21f..8e055f3 100755 (executable)
@@ -1999,6 +1999,7 @@ static gchar *convert_bssid_to_str(unsigned char *bssid)
        return g_string_free(bssid_str, FALSE);
 }
 
+#if defined TIZEN_EXT_INS
 static void count_assoc_reject(gpointer data, gpointer user_data)
 {
        time_t assoc_reject_time = GPOINTER_TO_INT(data);
@@ -2054,7 +2055,6 @@ static uint16_t get_assoc_reject_cnt(GHashTable *assoc_reject_table, unsigned ch
        return assoc_count.assoc_count;
 }
 
-#if defined TIZEN_EXT_INS
 static int calculate_score_last_connected_bssid(bool is_last_connected)
 {
        int score = 0;
@@ -2133,14 +2133,12 @@ static int calculate_score(bool is_last_connected, uint16_t assoc_reject_cnt,
 {
        int score = 0;
 
-#if defined TIZEN_EXT_INS
        score += calculate_score_last_connected_bssid(is_last_connected);
        score += calculate_score_assoc_reject(assoc_reject_cnt);
        score += calculate_score_frequency(strength, frequency);
        score += calculate_score_strength(strength);
        score += (int)snr;
        score += calculate_score_est_throughput(est_throughput);
-#endif
 
        return score;
 }
@@ -2164,23 +2162,23 @@ static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
 
                bssids->frequency = bss->frequency;
 
+#if defined TIZEN_EXT_INS
                bssids->assoc_reject_cnt = get_assoc_reject_cnt(bssid_data->assoc_reject_table, bssids->bssid);
-
                bssids->is_last_connected = compare_bssid(bssids->bssid, bssid_data->last_connected_bssid);
 
-#if defined TIZEN_EXT_INS
                bssids->score_last_connected_bssid = calculate_score_last_connected_bssid(bssids->is_last_connected);
                bssids->score_assoc_reject = calculate_score_assoc_reject(bssids->assoc_reject_cnt);
                bssids->score_frequency = calculate_score_frequency(bss->signal, bssids->frequency);
                bssids->score_strength = calculate_score_strength(bss->signal);
                bssids->score_snr = (int)bss->snr;
                bssids->score_est_throughput = calculate_score_est_throughput(bss->est_throughput);
-#endif
 
                bssids->ins_score = calculate_score(bssids->is_last_connected,
                        bssids->assoc_reject_cnt, bssids->frequency, bss->signal,
                        bss->snr, bss->est_throughput);
-
+#else
+               bssids->ins_score = bss->signal;
+#endif
                bssid_data->bssid_list = g_slist_append(bssid_data->bssid_list, bssids);
        } else
                SUPPLICANT_DBG("Failed to allocate memory");
@@ -2563,6 +2561,7 @@ static bool update_best_bss(GSupplicantNetwork *network,
                return true;
        }
 
+#if defined TIZEN_EXT_INS
        score_new = calculate_score(
                compare_bssid(bss->bssid, network->last_connected_bssid),
                get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
@@ -2573,6 +2572,10 @@ static bool update_best_bss(GSupplicantNetwork *network,
                get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
                network->best_bss->frequency, network->best_bss->signal,
                network->best_bss->snr, network->best_bss->est_throughput);
+#else
+       score_new = bss->signal;
+       score_best = network->best_bss->signal;
+#endif
 
        if (score_new > score_best) {
                SUPPLICANT_DBG("new[" MACSTR "][%u] : best[" MACSTR "][%u]",