All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 2/9] android/bluetooth: Add support for adapter bonded devices property
Date: Wed, 11 Dec 2013 11:31:20 +0100	[thread overview]
Message-ID: <1386757887-29018-2-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1386757887-29018-1-git-send-email-szymon.janc@tieto.com>

This allows to get property with list of bonded devices.
---
 android/bluetooth.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 82003fd..b6ef3e6 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1729,11 +1729,26 @@ static uint8_t get_adapter_scan_mode(void)
 
 static uint8_t get_adapter_bonded_devices(void)
 {
-	DBG("Not implemented");
+	uint8_t buf[sizeof(bdaddr_t) * g_slist_length(devices)];
+	int i = 0;
+	GSList *l;
 
-	/* TODO: Add implementation */
+	DBG("");
 
-	return HAL_STATUS_FAILED;
+	for (l = devices; l; l = g_slist_next(l)) {
+		struct device *dev = l->data;
+
+		if (dev->bond_state != HAL_BOND_STATE_BONDED)
+			continue;
+
+		bdaddr2android(&dev->bdaddr, buf + (i * sizeof(bdaddr_t)));
+		i++;
+	}
+
+	send_adapter_property(HAL_PROP_ADAPTER_BONDED_DEVICES,
+						i * sizeof(bdaddr_t), buf);
+
+	return HAL_STATUS_SUCCESS;
 }
 
 static uint8_t get_adapter_discoverable_timeout(void)
-- 
1.8.3.2


  reply	other threads:[~2013-12-11 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 10:31 [PATCH 1/9] android/bluetooth: Add support for reporting adapter type property Szymon Janc
2013-12-11 10:31 ` Szymon Janc [this message]
2013-12-11 10:31 ` [PATCH 3/9] android/bluetooth: Add support for remote device friendly name Szymon Janc
2013-12-11 10:31 ` [PATCH 4/9] android/bluetooth: Free devices on service unregister Szymon Janc
2013-12-11 10:31 ` [PATCH 5/9] android/bluetooth: Add support for remote device class Szymon Janc
2013-12-11 10:31 ` [PATCH 6/9] android/bluetooth: Add support for remote device RSSI Szymon Janc
2013-12-12  0:04   ` Anderson Lizardo
2013-12-12  8:58     ` Szymon Janc
2013-12-12 11:03       ` Anderson Lizardo
2013-12-11 10:31 ` [PATCH 7/9] android/bluetooth: Add support for get remote device properties command Szymon Janc
2013-12-11 10:31 ` [PATCH 8/9] android/bluetooth: Add support for remote device type property Szymon Janc
2013-12-11 10:31 ` [PATCH 9/9] android/bluetooth: Code style and whitespace cleanup Szymon Janc
2013-12-11 13:50 ` [PATCH 1/9] android/bluetooth: Add support for reporting adapter type property Johan Hedberg

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=1386757887-29018-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.