* Simple SDP and RFCOMM example
@ 2019-11-12 9:15 Kristóf Horváth
2019-11-12 13:48 ` Szymon Janc
0 siblings, 1 reply; 4+ messages in thread
From: Kristóf Horváth @ 2019-11-12 9:15 UTC (permalink / raw)
To: linux-bluetooth
Hello,
I started a project with Bluetooth, but most of the resources on the
internet use older versions of BlueZ (and often mention using
compatibility mode to hack the legacy code). I think the reason for
the hacking is that there is not any tutorial for BlueZ 5 (or it is in
some very hidden place). I browsed the page
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test for
examples, and I found some interesting codes, but I could not find
what I was searching for.
I would like to see a simple Python code that can register a service
via SDP and receive the incoming RFCOMM connections. Could you provide
an example like that?
Thank you for your help.
Regards,
Kristóf Horváth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Simple SDP and RFCOMM example
2019-11-12 9:15 Simple SDP and RFCOMM example Kristóf Horváth
@ 2019-11-12 13:48 ` Szymon Janc
2019-11-13 17:23 ` Kristóf Horváth
0 siblings, 1 reply; 4+ messages in thread
From: Szymon Janc @ 2019-11-12 13:48 UTC (permalink / raw)
To: Kristóf Horváth; +Cc: linux-bluetooth
Hi,
On Tuesday, 12 November 2019 10:15:38 CET Kristóf Horváth wrote:
> Hello,
>
> I started a project with Bluetooth, but most of the resources on the
> internet use older versions of BlueZ (and often mention using
> compatibility mode to hack the legacy code). I think the reason for
> the hacking is that there is not any tutorial for BlueZ 5 (or it is in
> some very hidden place). I browsed the page
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test for
> examples, and I found some interesting codes, but I could not find
> what I was searching for.
>
> I would like to see a simple Python code that can register a service
> via SDP and receive the incoming RFCOMM connections. Could you provide
> an example like that?
>
> Thank you for your help.
There is test/test-profile and test/test-hfp in BlueZ source code.
--
pozdrawiam
Szymon Janc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Simple SDP and RFCOMM example
2019-11-12 13:48 ` Szymon Janc
@ 2019-11-13 17:23 ` Kristóf Horváth
2019-11-13 18:03 ` Barry Byford
0 siblings, 1 reply; 4+ messages in thread
From: Kristóf Horváth @ 2019-11-13 17:23 UTC (permalink / raw)
To: linux-bluetooth
Hi,
> There is test/test-profile and test/test-hfp in BlueZ source code.
Thank you very much. Without a table of contents, it's hard to find
the appropriate scripts. (This is also true for the files in folder
doc.)
With the test-profile code, I could register a service, and I could
discover it from another device. However, a connection couldn't build
up. The function NewConnection didn't call at all. (By the way, I
didn't find any line of code to receive the data, how is it possible?)
I monitored the connection-attempt with bluetoothctl (every row starts
with the prefix "[chg] Device {address of the other device}"):
ServiceResolved: yes
Paired: yes
(There was a little pause here.)
ServiceResolved: no
Paired: no
Connected: no
Have you got any idea what the problem is? Thank you for your help.
Regards,
Kristóf Horváth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Simple SDP and RFCOMM example
2019-11-13 17:23 ` Kristóf Horváth
@ 2019-11-13 18:03 ` Barry Byford
0 siblings, 0 replies; 4+ messages in thread
From: Barry Byford @ 2019-11-13 18:03 UTC (permalink / raw)
To: Bluez mailing list
On Wed, 13 Nov 2019 at 17:29, Kristóf Horváth
<horvath.kristof.attila@gmail.com> wrote:
>
> Hi,
>
> > There is test/test-profile and test/test-hfp in BlueZ source code.
> With the test-profile code, I could register a service, and I could
> discover it from another device. However, a connection couldn't build
> up. The function NewConnection didn't call at all. (By the way, I
> didn't find any line of code to receive the data, how is it possible?)
Here is an example of receiving data with a Serial Port Profile:
https://gist.github.com/ukBaz/217875c83c2535d22a16ba38fc8f2a91
Going back to your original question, you might find it easier to use
a Python library like Blue Dot on your project as it presents a higher
level interface:
https://bluedot.readthedocs.io/en/latest/btcommapi.html
Regards,
Barry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-13 18:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 9:15 Simple SDP and RFCOMM example Kristóf Horváth
2019-11-12 13:48 ` Szymon Janc
2019-11-13 17:23 ` Kristóf Horváth
2019-11-13 18:03 ` Barry Byford
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.