Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/5] android/hal-pan: Add implementation of .get_local_role
Date: Mon, 28 Oct 2013 14:09:04 +0200	[thread overview]
Message-ID: <1382962146-19587-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1382962146-19587-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 android/hal-msg.h |  5 +++++
 android/hal-pan.c | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/android/hal-msg.h b/android/hal-msg.h
index 0987eec..350cec1 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -297,6 +297,11 @@ struct hal_cmd_pan_enable {
 	uint8_t local_role;
 } __attribute__((packed));
 
+#define HAL_OP_PAN_GET_ROLE	0x02
+struct hal_rsp_pan_get_role {
+	uint8_t local_role;
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 
diff --git a/android/hal-pan.c b/android/hal-pan.c
index 8fb2563..c8dcdec 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -47,12 +47,21 @@ static bt_status_t pan_enable(int local_role)
 
 static int pan_get_local_role(void)
 {
+	struct hal_rsp_pan_get_role rsp;
+	size_t len = sizeof(rsp);
+	bt_status_t status;
+
 	DBG("");
 
 	if (!interface_ready())
 		return BTPAN_ROLE_NONE;
 
-	return BTPAN_ROLE_NONE;
+	status = hal_ipc_cmd(HAL_SERVICE_ID_PAN, HAL_OP_PAN_GET_ROLE, 0, NULL,
+							&len, &rsp, NULL);
+	if (status != BT_STATUS_SUCCESS)
+		return BTPAN_ROLE_NONE;
+
+	return rsp.local_role;
 }
 
 static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,
-- 
1.8.3.1


  parent reply	other threads:[~2013-10-28 12:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 12:09 [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 2/5] android/hal-pan: Add implementation of .enable Luiz Augusto von Dentz
2013-10-28 12:09 ` Luiz Augusto von Dentz [this message]
2013-10-28 12:09 ` [PATCH BlueZ 4/5] android/hal-pan: Add implementation of .connect Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 5/5] android/hal-pan: Add implementation of .disconnect Luiz Augusto von Dentz
2013-10-28 12:43 ` [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init 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=1382962146-19587-3-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.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