From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH v2 1/3] android/bluetooth: Add threshold to RSSI change
Date: Tue, 4 Feb 2014 17:34:21 +0100 [thread overview]
Message-ID: <1391531663-13143-1-git-send-email-szymon.janc@tieto.com> (raw)
There is no need to report very small RSSI changes.
---
v2: Fix name and use abs()
android/bluetooth.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/android/bluetooth.c b/android/bluetooth.c
index d74d792..5aed4af 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1045,6 +1045,12 @@ static uint8_t bdaddr_type2android(uint8_t type)
return HAL_TYPE_LE;
}
+static bool rssi_above_threshold(int old, int new)
+{
+ /* only 8 dBm or more */
+ return abs(old - new) >= 8;
+}
+
static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
int8_t rssi, bool confirm,
const uint8_t *data, uint8_t data_len)
@@ -1113,7 +1119,7 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
(*num_prop)++;
}
- if (rssi) {
+ if (rssi && rssi_above_threshold(dev->rssi, rssi)) {
dev->rssi = rssi;
size += fill_hal_prop(buf + size, HAL_PROP_DEVICE_RSSI,
--
1.8.3.2
next reply other threads:[~2014-02-04 16:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 16:34 Szymon Janc [this message]
2014-02-04 16:34 ` [PATCH v2 2/3] android/bluetooth: Refactor update_found_device function Szymon Janc
2014-02-04 16:34 ` [PATCH v2 3/3] android/bluetooth: Send prop change event only if prop was changed Szymon Janc
2014-02-04 16:43 ` [PATCH v2 1/3] android/bluetooth: Add threshold to RSSI change Marcel Holtmann
2014-02-05 8:48 ` Szymon Janc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391531663-13143-1-git-send-email-szymon.janc@tieto.com \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox