Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Veseli Veseljko <veseljko75@gmail.com>,
	Szymon Janc <szymon.janc@gmail.com>
Subject: [RFC 1/2] core/device: Add support for setting SDP record
Date: Sun,  8 Mar 2015 17:08:29 +0100	[thread overview]
Message-ID: <1425830910-9549-2-git-send-email-szymon.janc@gmail.com> (raw)
In-Reply-To: <1425830910-9549-1-git-send-email-szymon.janc@gmail.com>

This allows to set SDP record for device without resolving services
over SDP.
---
 src/device.c | 37 +++++++++++++++++++++++++++++++++++++
 src/device.h |  3 +++
 2 files changed, 40 insertions(+)

diff --git a/src/device.c b/src/device.c
index 9e23c19..6e896ba 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5272,6 +5272,43 @@ static sdp_list_t *read_device_records(struct btd_device *device)
 	return recs;
 }
 
+void btd_device_set_record(struct btd_device *device, const char *uuid,
+							sdp_record_t *rec)
+{
+	/* This API is only used for BR/EDR */
+	struct bearer_state *state = &device->bredr_state;
+	struct browse_req *req;
+	sdp_list_t *recs = NULL;
+
+	if (!rec)
+		return;
+
+	req = browse_request_new(device, NULL);
+	if (!req)
+		return;
+
+	recs = sdp_list_append(recs, rec);
+	update_bredr_services(req, recs);
+	sdp_list_free(recs, NULL);
+
+	if (device->tmp_records) {
+		if (find_record_in_list(device->tmp_records, uuid))
+			return;
+
+		sdp_list_free(device->tmp_records,
+					(sdp_free_func_t) sdp_record_free);
+	}
+
+	device->tmp_records = sdp_list_append(NULL, rec);
+
+	device->svc_refreshed = true;
+	state->svc_resolved = true;
+
+	btd_device_add_uuid(device, uuid);
+
+	device_svc_resolved(device, device->bdaddr_type, 0);
+}
+
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 							const char *uuid)
 {
diff --git a/src/device.h b/src/device.h
index 8edd0df..f42b3f4 100644
--- a/src/device.h
+++ b/src/device.h
@@ -62,6 +62,9 @@ struct device_addr_type {
 int device_addr_type_cmp(gconstpointer a, gconstpointer b);
 GSList *btd_device_get_uuids(struct btd_device *device);
 void device_probe_profiles(struct btd_device *device, GSList *profiles);
+
+void btd_device_set_record(struct btd_device *device, const char *uuid,
+							sdp_record_t *rec);
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 						const char *uuid);
 struct gatt_primary *btd_device_get_primary(struct btd_device *device,
-- 
2.1.4


  reply	other threads:[~2015-03-08 16:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 16:08 [RFC 0/2] input: Improved support for DualShock 3 clones Szymon Janc
2015-03-08 16:08 ` Szymon Janc [this message]
2015-03-08 16:08 ` [RFC 2/2] profiles/input: Add support for SDP fallback " Szymon Janc
2015-03-09 11:21   ` Antonio Ospite
2015-03-09 13:37     ` Szymon Janc
2015-03-09 16:53       ` Bastien Nocera

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=1425830910-9549-2-git-send-email-szymon.janc@gmail.com \
    --to=szymon.janc@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=veseljko75@gmail.com \
    /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