Try to fix metric

This commit is contained in:
PolynomialDivision 2017-09-18 20:51:19 +02:00
parent b14d251888
commit c387a59f33
4 changed files with 25 additions and 8 deletions

View file

@ -18,4 +18,5 @@ config settings metric
option rssi '10'
option freq '50'
option chan_util '0'
option max_chan_util '100'
option min_rssi '-60'

View file

@ -23,6 +23,8 @@ struct probe_metric_s {
int rssi;
int freq;
int chan_util;
int max_chan_util;
int min_rssi;
};
#define SORT_NUM 5

View file

@ -48,16 +48,12 @@ int eval_probe_metric(struct probe_entry_s probe_entry) {
score += !probe_entry.ht_support && !ap_entry.ht ? dawn_metric.no_ht_support : 0;
score += probe_entry.vht_support ? dawn_metric.vht_support : 0;
score += !probe_entry.vht_support && !ap_entry.vht ? dawn_metric.no_vht_support : 0;
score += ap_entry.channel_utilization <= dawn_metric.max_chan_util ? dawn_metric.chan_util : 0;
}
//score += probe_entry.ht_support ? dawn_metric.ht_support : 0;
//score += !probe_entry.ht_support && !ap_entry.ht ? dawn_metric.n_ht_support : 0;
//score += probe_entry.vht_support ? dawn_metric.vht_support : 0;
score += (probe_entry.freq > 5000) ? dawn_metric.freq : 0;
score += (probe_entry.signal > -60) ? dawn_metric.rssi : 0;
score += (probe_entry.signal >= dawn_metric.min_rssi) ? dawn_metric.rssi : 0;
// TODO: Add minimal rssi threshold
printf("SCORE: %d\n", score);
print_probe_entry(probe_entry);

View file

@ -54,7 +54,7 @@ struct probe_metric_s uci_get_dawn_metric()
if(ptr.o->type == UCI_TYPE_STRING)
ret.no_vht_support = atoi(ptr.o->v.string);
char tmp_rssi[] = "dawn.metric.freq";
char tmp_rssi[] = "dawn.metric.rssi";
if (uci_lookup_ptr (c, &ptr, tmp_rssi, 1) != UCI_OK) {
uci_perror(c, "uci_get_daw_metric Error");
return ret;
@ -78,6 +78,24 @@ struct probe_metric_s uci_get_dawn_metric()
if(ptr.o->type == UCI_TYPE_STRING)
ret.chan_util = atoi(ptr.o->v.string);
char tmp_min_rssi[] = "dawn.metric.min_rssi";
if (uci_lookup_ptr (c, &ptr, tmp_min_rssi, 1) != UCI_OK) {
uci_perror(c, "uci_get_daw_metric Error");
return ret;
}
if(ptr.o->type == UCI_TYPE_STRING)
ret.min_rssi = atoi(ptr.o->v.string);
char tmp_max_chan_util[] = "dawn.metric.max_chan_util";
if (uci_lookup_ptr (c, &ptr, tmp_max_chan_util, 1) != UCI_OK) {
uci_perror(c, "uci_get_daw_metric Error");
return ret;
}
if(ptr.o->type == UCI_TYPE_STRING)
ret.max_chan_util = atoi(ptr.o->v.string);
printf("Loaded metric: %d, %d\n", ret.min_rssi, ret.max_chan_util);
uci_free_context (c);
return ret;