diff --git a/files/dawn.config b/files/dawn.config index f83c9c7..0678b73 100644 --- a/files/dawn.config +++ b/files/dawn.config @@ -19,4 +19,5 @@ config settings metric option freq '50' option chan_util '0' option max_chan_util '100' - option min_rssi '-60' \ No newline at end of file + option min_rssi '-60' + option min_probe_count '5' \ No newline at end of file diff --git a/src/include/datastorage.h b/src/include/datastorage.h index ebd623a..d688b52 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -25,6 +25,7 @@ struct probe_metric_s { int chan_util; int max_chan_util; int min_rssi; + int min_probe_count; }; #define SORT_NUM 5 diff --git a/src/utils/dawn_uci.c b/src/utils/dawn_uci.c index 03288b1..887caa1 100644 --- a/src/utils/dawn_uci.c +++ b/src/utils/dawn_uci.c @@ -94,7 +94,15 @@ struct probe_metric_s uci_get_dawn_metric() 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); + char tmp_min_probe_count[] = "dawn.min_probe_count"; + if (uci_lookup_ptr (c, &ptr, tmp_min_probe_count, 1) != UCI_OK) { + uci_perror(c, "uci_get_daw_metric Error"); + return ret; + } + if(ptr.o->type == UCI_TYPE_STRING) + ret.min_probe_count = atoi(ptr.o->v.string); + + printf("Loaded metric: %d\n", ret.min_probe_count); uci_free_context (c); diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 51c3ffa..6951b84 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -136,7 +136,7 @@ static int decide_function(probe_entry *prob_req) { // TODO: Refactor... //printf("COUNTER: %d\n", prob_req->counter); - if (prob_req->counter < MIN_PROBE_REQ) { + if (prob_req->counter < dawn_metric.min_probe_count) { return 0; }