2013-03-04 16:42:56

by Randy Yates

[permalink] [raw]
Subject: rfcomm example setup

Can someone please point me to an example of the bind, listen, and
accept structures and parameters for setting up an RFCOMM socket using
file descriptor (fd) received from the NewConnection() method in
profile-api.txt?

I tried the setup in "Bluetooth Essentials for Programmers," omitting
the socket() call (since bluez provides the fd) but it's crashing right
at the bind() call (never reaches the "bt 0.1" fprintf()). See
attachment.
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com


Attachments:
btsocketthread.c (4.87 kB)

2013-03-04 20:30:35

by Randy Yates

[permalink] [raw]
Subject: Re: rfcomm example setup

Thanks!

--Randy

Luiz Augusto von Dentz <[email protected]> writes:

> Hi Randy,
>
> On Mon, Mar 4, 2013 at 6:42 PM, Randy Yates <[email protected]> wrote:
>> Can someone please point me to an example of the bind, listen, and
>> accept structures and parameters for setting up an RFCOMM socket using
>> file descriptor (fd) received from the NewConnection() method in
>> profile-api.txt?
>>
>> I tried the setup in "Bluetooth Essentials for Programmers," omitting
>> the socket() call (since bluez provides the fd) but it's crashing right
>> at the bind() call (never reaches the "bt 0.1" fprintf()). See
>> attachment.
>
> You don't have to bind, the socket is already in connected state so
> you can already do read/write operations. Btw, don't forget to respond
> to NewConnection otherwise it will timeout and bluetoothd will
> probably disconnect the fd.

--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com

2013-03-04 20:25:12

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: rfcomm example setup

Hi Randy,

On Mon, Mar 4, 2013 at 6:42 PM, Randy Yates <[email protected]> wrote:
> Can someone please point me to an example of the bind, listen, and
> accept structures and parameters for setting up an RFCOMM socket using
> file descriptor (fd) received from the NewConnection() method in
> profile-api.txt?
>
> I tried the setup in "Bluetooth Essentials for Programmers," omitting
> the socket() call (since bluez provides the fd) but it's crashing right
> at the bind() call (never reaches the "bt 0.1" fprintf()). See
> attachment.

You don't have to bind, the socket is already in connected state so
you can already do read/write operations. Btw, don't forget to respond
to NewConnection otherwise it will timeout and bluetoothd will
probably disconnect the fd.


--
Luiz Augusto von Dentz