diff --git a/src/adv_monitor.c b/src/adv_monitor.c
index 9f04aae..17f1777 100644
--- a/src/adv_monitor.c
+++ b/src/adv_monitor.c
#include "lib/mgmt.h"
#include "adapter.h"
+#include "btd.h"
#include "dbus-common.h"
#include "device.h"
#include "log.h"
#define ADV_MONITOR_DEFAULT_HIGH_TIMEOUT 10 /* second */
#define ADV_MONITOR_UNSET_SAMPLING_PERIOD 256 /* 100 ms */
#define ADV_MONITOR_MAX_SAMPLING_PERIOD 255 /* 100 ms */
-#define ADV_MONITOR_DEFAULT_SAMPLING_PERIOD 0 /* 100 ms */
struct btd_adv_monitor_manager {
struct btd_adapter *adapter;
h_rssi_timeout = ADV_MONITOR_DEFAULT_HIGH_TIMEOUT;
if (sampling_period == ADV_MONITOR_UNSET_SAMPLING_PERIOD)
- sampling_period = ADV_MONITOR_DEFAULT_SAMPLING_PERIOD;
+ sampling_period = btd_opts.advmon.rssi_sampling_period;
if (h_rssi < ADV_MONITOR_MIN_RSSI || h_rssi > ADV_MONITOR_MAX_RSSI ||
l_rssi < ADV_MONITOR_MIN_RSSI ||
diff --git a/src/btd.h b/src/btd.h
index 6af54a9..d728835 100644
--- a/src/btd.h
+++ b/src/btd.h
uint8_t stream_mode;
};
+struct btd_advmon_opts {
+ uint8_t rssi_sampling_period;
+};
+
struct btd_opts {
char *name;
uint32_t class;
uint8_t key_size;
enum jw_repairing_t jw_repairing;
+
+ struct btd_advmon_opts advmon;
};
extern struct btd_opts btd_opts;
diff --git a/src/main.c b/src/main.c
index 57db9c1..516509e 100644
--- a/src/main.c
+++ b/src/main.c
NULL
};
+static const char *advmon_options[] = {
+ "RSSISamplingPeriod",
+ NULL
+};
+
static const struct group_table {
const char *name;
const char **options;
{ "Policy", policy_options },
{ "GATT", gatt_options },
{ "AVDTP", avdtp_options },
+ { "AdvMon", advmon_options },
{ }
};
g_free(str);
}
+ val = g_key_file_get_integer(config, "AdvMon", "RSSISamplingPeriod",
+ &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ } else {
+ val = MIN(val, 0xFF);
+ val = MAX(val, 0);
+ DBG("RSSISamplingPeriod=%d", val);
+ btd_opts.advmon.rssi_sampling_period = val;
+ }
+
parse_br_config(config);
parse_le_config(config);
}
btd_opts.avdtp.session_mode = BT_IO_MODE_BASIC;
btd_opts.avdtp.stream_mode = BT_IO_MODE_BASIC;
+
+ btd_opts.advmon.rssi_sampling_period = 0;
}
static void log_handler(const gchar *log_domain, GLogLevelFlags log_level,
diff --git a/src/main.conf b/src/main.conf
index bf8a860..1988995 100644
--- a/src/main.conf
+++ b/src/main.conf
# The value is in seconds.
# Default: 2
#ResumeDelay = 2
+
+[AdvMon]
+# Default RSSI Sampling Period. This is used when a client registers an
+# advertisement monitor and leaves the RSSISamplingPeriod unset.
+# Default: 0
+#RSSISamplingPeriod=0