linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH 10/10] android/pan: Add PAN NAP sdp record fo server role
Date: Wed, 11 Dec 2013 12:13:45 +0200	[thread overview]
Message-ID: <1386756825-934-11-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1386756825-934-1-git-send-email-ravikumar.veeramally@linux.intel.com>

Adding PAN profile NAP SDP record on profile register call and
remove on unregister call.
---
 android/pan.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/android/pan.c b/android/pan.c
index 29b0a54..a6a8e27 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -44,9 +44,12 @@
 #include "utils.h"
 #include "bluetooth.h"
 
+#define SVC_HINT_CAPTURING 0x08
+
 static bdaddr_t adapter_addr;
 GSList *devices = NULL;
 uint8_t local_role = HAL_PAN_ROLE_NONE;
+static uint32_t record_id = 0;
 
 struct pan_device {
 	char		iface[16];
@@ -343,6 +346,7 @@ static const struct ipc_handler cmd_handlers[] = {
 
 bool bt_pan_register(const bdaddr_t *addr)
 {
+	sdp_record_t *rec = NULL;
 	int err;
 
 	DBG("");
@@ -355,6 +359,21 @@ bool bt_pan_register(const bdaddr_t *addr)
 		return false;
 	}
 
+	rec = pan_record("bnepnap", BNEP_SVC_NAP, TRUE);
+	if (!rec) {
+		bnep_cleanup();
+		return false;
+	}
+
+	if (bt_adapter_add_record(rec, SVC_HINT_CAPTURING) < 0) {
+		error("Failed to register on PAN record");
+		sdp_record_free(rec);
+		bnep_cleanup();
+		return false;
+	}
+
+	record_id = rec->handle;
+
 	ipc_register(HAL_SERVICE_ID_PAN, cmd_handlers,
 						G_N_ELEMENTS(cmd_handlers));
 
@@ -373,6 +392,8 @@ void bt_pan_unregister(void)
 {
 	DBG("");
 
+	bt_adapter_remove_record(record_id);
+
 	g_slist_foreach(devices, free_pan_devices, NULL);
 	devices = NULL;
 	bnep_cleanup();
-- 
1.8.3.2


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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 10:13 [PATCH 00/10] Refactoring bnep code to reduce redundancy Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 01/10] bnep: Rename bnep_kill_connection to bnep_conndel Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 02/10] bnep: Rename send ctrl_rsp and make it global Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 03/10] bnep: Move bnep related calls to bnep.h|c Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 04/10] profiles/network/server: Delete function which does nothing Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 05/10] profiles/network: Move pan sdp record function bnep and make it global Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 06/10] android/pan: Remove channel unref which causing disconnection Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 07/10] android/pan: Fix missing cleanup calls Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 08/10] android/pan: Fix minor white space Ravi kumar Veeramally
2013-12-11 10:13 ` [PATCH 09/10] android/pan: Free connected pan devices on profile unregister call Ravi kumar Veeramally
2013-12-11 10:13 ` Ravi kumar Veeramally [this message]
2013-12-11 13:33 ` [PATCH 00/10] Refactoring bnep code to reduce redundancy 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=1386756825-934-11-git-send-email-ravikumar.veeramally@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.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;
as well as URLs for NNTP newsgroup(s).