From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCHv3 16/16] android/socket: Add SDP record for OPP profile
Date: Mon, 18 Nov 2013 11:28:42 +0200 [thread overview]
Message-ID: <20131118092840.GA21114@aemeltch-MOBL1> (raw)
In-Reply-To: <1384763179-2218-17-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi,
On Mon, Nov 18, 2013 at 10:26:19AM +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> This adds SDP record for OPP shown below:
>
> Service Name: OBEX Object Push
> Service RecHandle: 0x10002
> Service Class ID List:
> "OBEX Object Push" (0x1105)
> Protocol Descriptor List:
> "RFCOMM" (0x0003)
> Channel: 9
> "OBEX" (0x0008)
> Profile Descriptor List:
> "OBEX Object Push" (0x1105)
> Version: 0x0100
> ---
> android/socket.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 94 insertions(+)
>
> diff --git a/android/socket.c b/android/socket.c
> index 6b50014..989b876 100644
> --- a/android/socket.c
> +++ b/android/socket.c
> @@ -36,6 +36,7 @@
> #include "lib/sdp_lib.h"
> #include "src/sdp-client.h"
>
> +#include "bluetooth.h"
> #include "log.h"
> #include "hal-msg.h"
> #include "hal-ipc.h"
> @@ -43,6 +44,9 @@
> #include "utils.h"
> #include "socket.h"
>
> +/* Use Object Transfer for all services */
> +#define SVC_HINT_OBEX 0x10
> +
> static bdaddr_t adapter_addr;
>
> /* Simple list of RFCOMM server sockets */
> @@ -56,6 +60,7 @@ struct rfcomm_slot {
> int real_sock; /* real RFCOMM socket */
> int channel; /* RFCOMM channel */
> bdaddr_t dst;
> + uint32_t service_handle;
> };
>
> static struct rfcomm_slot *create_rfslot(int sock, int *hal_fd)
> @@ -86,6 +91,9 @@ static void cleanup_rfslot(struct rfcomm_slot *rfslot)
> if (rfslot->real_sock > 0)
> close(rfslot->real_sock);
>
> + if (rfslot->service_handle)
> + bt_adapter_remove_record(rfslot->service_handle);
> +
> g_free(rfslot);
> }
>
> @@ -108,6 +116,90 @@ static struct {
> { {0} }
> };
>
> +static sdp_record_t *create_opp_record(uint8_t chan)
> +{
> + sdp_list_t *svclass_id, *pfseq, *apseq, *root;
> + uuid_t root_uuid, opush_uuid, rfcomm_uuid, obex_uuid;
> + sdp_profile_desc_t profile[1];
> + sdp_list_t *aproto, *proto[2];
> + uint8_t formats[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xff };
> + void *dtds[sizeof(formats)], *values[sizeof(formats)];
> + unsigned int i;
> + uint8_t dtd = SDP_UINT8;
> + sdp_data_t *sflist;
> + sdp_data_t *channel;
> + sdp_record_t *record;
> +
> + record = sdp_record_alloc();
> + if (!record)
> + return NULL;
> +
> + sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
> + root = sdp_list_append(0, &root_uuid);
> + sdp_set_browse_groups(record, root);
> +
> + sdp_uuid16_create(&opush_uuid, OBEX_OBJPUSH_SVCLASS_ID);
> + svclass_id = sdp_list_append(0, &opush_uuid);
> + sdp_set_service_classes(record, svclass_id);
> +
> + sdp_uuid16_create(&profile[0].uuid, OBEX_OBJPUSH_PROFILE_ID);
> + profile[0].version = 0x0100;
> + pfseq = sdp_list_append(0, profile);
> + sdp_set_profile_descs(record, pfseq);
> +
> + sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
> + proto[0] = sdp_list_append(0, &rfcomm_uuid);
> + channel = sdp_data_alloc(SDP_UINT8, &chan);
> + proto[0] = sdp_list_append(proto[0], channel);
> + apseq = sdp_list_append(apseq, proto[0]);
fixed myself to:
@@ -161,7 +161,7 @@ static sdp_record_t *create_opp_record(uint8_t chan)
proto[0] = sdp_list_append(0, &rfcomm_uuid);
channel = sdp_data_alloc(SDP_UINT8, &chan);
proto[0] = sdp_list_append(proto[0], channel);
- apseq = sdp_list_append(apseq, proto[0]);
+ apseq = sdp_list_append(0, proto[0]);
sdp_uuid16_create(&obex_uuid, OBEX_UUID);
proto[1] = sdp_list_append(0, &obex_uuid);
Best regards
Andrei Emeltchenko
prev parent reply other threads:[~2013-11-18 9:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 8:26 [PATCHv3 00/16] Socket HAL Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 01/16] android/hal-sock: Add debug flag printing Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 02/16] android/socket: Use static local adapter address Andrei Emeltchenko
2013-11-18 8:46 ` Johan Hedberg
2013-11-18 8:26 ` [PATCHv3 03/16] android/socket: Add connect signal to socket Andrei Emeltchenko
2013-11-18 8:45 ` Johan Hedberg
2013-11-18 8:26 ` [PATCHv3 04/16] android/socket: Define structs and implement listen Andrei Emeltchenko
2013-11-18 8:55 ` Johan Hedberg
2013-11-18 10:02 ` Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 05/16] android/socket: Implement socket accepted event Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 06/16] android/socket: Implement Android RFCOMM stack events Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 07/16] android/socket: Implement RFCOMM events Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 08/16] android/socket: Implement accept signal over Android fd Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 09/16] android/socket: Write channel to " Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 10/16] android/socket: Implement socket connect HAL method Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 11/16] android/socket: Parse SDP response and connect Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 12/16] android/socket: Implement HAL connect call Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 13/16] android/socket: Send RFCOMM channel to framework Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 14/16] android/socket: Send connect signal on connect Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 15/16] android/socket: Close file descriptor after sending Andrei Emeltchenko
2013-11-18 8:26 ` [PATCHv3 16/16] android/socket: Add SDP record for OPP profile Andrei Emeltchenko
2013-11-18 9:28 ` Andrei Emeltchenko [this message]
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=20131118092840.GA21114@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@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;
as well as URLs for NNTP newsgroup(s).