Merge pull request #13 from berlin-open-wireless-lab/feature/new_lowest_rssi_value

add a lowest rssi to metric
This commit is contained in:
Polynomdivision 2017-12-12 10:58:07 +01:00 committed by GitHub
commit bd91b75178
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 6 deletions

View file

@ -24,8 +24,10 @@ config settings metric
option no_ht_support '0'
option no_vht_support '0'
option rssi '10'
option low_rssi '-500'
option freq '50'
option chan_util '50'
option max_chan_util '150'
option min_rssi '-60'
option rssi_val '-60'
option low_rssi_val '-79'
option min_probe_count '2'

View file

@ -23,10 +23,12 @@ struct probe_metric_s {
int no_ht_support;
int no_vht_support;
int rssi;
int low_rssi;
int freq;
int chan_util;
int max_chan_util;
int min_rssi;
int rssi_val;
int low_rssi_val;
int min_probe_count;
};

View file

@ -79,7 +79,8 @@ int eval_probe_metric(struct probe_entry_s probe_entry) {
}
score += (probe_entry.freq > 5000) ? dawn_metric.freq : 0;
score += (probe_entry.signal >= dawn_metric.min_rssi) ? dawn_metric.rssi : 0;
score += (probe_entry.signal >= dawn_metric.rssi_val) ? dawn_metric.rssi : 0;
score += (probe_entry.signal <= dawn_metric.low_rssi_val) ? dawn_metric.low_rssi : 0;
printf("SCORE: %d\n", score);
print_probe_entry(probe_entry);

View file

@ -142,13 +142,13 @@ 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) {
char tmp_rssi_val[] = "dawn.metric.rssi_val";
if (uci_lookup_ptr(c, &ptr, tmp_rssi_val, 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);
ret.rssi_val = 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) {
@ -168,6 +168,22 @@ struct probe_metric_s uci_get_dawn_metric() {
if (ptr.o->type == UCI_TYPE_STRING)
ret.min_probe_count = atoi(ptr.o->v.string);
char tmp_low_rssi[] = "dawn.metric.low_rssi";
if (uci_lookup_ptr(c, &ptr, tmp_low_rssi, 1) != UCI_OK) {
uci_perror(c, "uci_get_daw_metric Error");
return ret;
}
if (ptr.o->type == UCI_TYPE_STRING)
ret.low_rssi = atoi(ptr.o->v.string);
char tmp_low_rssi_val[] = "dawn.metric.low_rssi_val";
if (uci_lookup_ptr(c, &ptr, tmp_low_rssi_val, 1) != UCI_OK) {
uci_perror(c, "uci_get_daw_metric Error");
return ret;
}
if (ptr.o->type == UCI_TYPE_STRING)
ret.low_rssi_val = atoi(ptr.o->v.string);
printf("Loaded metric: %d\n", ret.min_probe_count);
uci_free_context(c);