From cb59ec7853da1001702e3a7feeb57473482b5a74 Mon Sep 17 00:00:00 2001 From: Christian Fetzer Date: Fri, 12 Apr 2013 11:29:03 +0200 Subject: [PATCH] obexd: Add bluetooth_getattribute to Bluetooth transport This function makes the cached SDP attributes available for the profile implementations. --- obexd/client/bluetooth.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/obexd/client/bluetooth.c b/obexd/client/bluetooth.c index a14b75bdc..1f407d1b4 100644 --- a/obexd/client/bluetooth.c +++ b/obexd/client/bluetooth.c @@ -467,11 +467,35 @@ static int bluetooth_getpacketopt(GIOChannel *io, int *tx_mtu, int *rx_mtu) return 0; } +static const void *bluetooth_getattribute(guint id, int attribute_id) +{ + GSList *l; + sdp_data_t *data; + + for (l = sessions; l; l = l->next) { + struct bluetooth_session *session = l->data; + + if (session->id != id) + continue; + + if (session->sdp_record == NULL) + break; + + data = sdp_data_get(session->sdp_record, attribute_id); + if (!data) + break; + + return &data->val; + } + return NULL; +} + static struct obc_transport bluetooth = { .name = "Bluetooth", .connect = bluetooth_connect, .getpacketopt = bluetooth_getpacketopt, .disconnect = bluetooth_disconnect, + .getattribute = bluetooth_getattribute, }; int bluetooth_init(void) -- 2.47.3