2019-07-12 15:15:41

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

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

This uses application ObjectManager to discover the MediaEndpoint and
MediaPlayer object of an application and deprecates the use of
RegisterEndpoint and RegisterPlayer.
---
doc/media-api.txt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index bca8c9563..07f7ac3e0 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties)

Unregister sender media player.

+ void RegisterApplication(object root, dict options)

+ Register endpoints an player objects within root
+ object which must implement ObjectManager.
+
+ The application object path together with the D-Bus
+ system bus connection ID define the identification of
+ the application.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.AlreadyExists
+
+ void UnregisterApplication(object application)
+
+ This unregisters the services that has been
+ previously registered. The object path parameter
+ must match the same value that has been used
+ on registration.
+
+ Possible errors: org.bluez.Error.InvalidArguments
+ org.bluez.Error.DoesNotExist
Media Control hierarchy
=======================

--
2.21.0


2019-07-12 15:16:22

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 3/4] test: Add example-endpoint

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

This adds an example of registering an endpoint with use of
RegisterApplication.
---
test/example-endpoint | 186 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 186 insertions(+)
create mode 100644 test/example-endpoint

diff --git a/test/example-endpoint b/test/example-endpoint
new file mode 100644
index 000000000..a5f0348a0
--- /dev/null
+++ b/test/example-endpoint
@@ -0,0 +1,186 @@
+#!/usr/bin/python
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import sys
+import dbus
+import dbus.exceptions
+import dbus.service
+import dbus.mainloop.glib
+
+import array
+try:
+ from gi.repository import GObject
+except ImportError:
+ import gobject as GObject
+import bluezutils
+
+ENDPOINT_IFACE = 'org.bluez.MediaEndpoint1'
+DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager'
+DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties'
+
+A2DP_SOURCE_UUID = '0000110A-0000-1000-8000-00805F9B34FB'
+A2DP_SINK_UUID = '0000110B-0000-1000-8000-00805F9B34FB'
+
+SBC_CODEC = dbus.Byte(0x00)
+#Channel Modes: Mono DualChannel Stereo JointStereo
+#Frequencies: 16Khz 32Khz 44.1Khz 48Khz
+#Subbands: 4 8
+#Blocks: 4 8 12 16
+#Bitpool Range: 2-64
+SBC_CAPABILITIES = dbus.Array([dbus.Byte(0xff), dbus.Byte(0xff), dbus.Byte(2), dbus.Byte(64)])
+# JointStereo 44.1Khz Subbands: Blocks: 16 Bitpool Range: 2-32
+SBC_CONFIGURATION = dbus.Array([dbus.Byte(0x21), dbus.Byte(0x15), dbus.Byte(2), dbus.Byte(32)])
+
+MP3_CODEC = dbus.Byte(0x01)
+#Channel Modes: Mono DualChannel Stereo JointStereo
+#Frequencies: 32Khz 44.1Khz 48Khz
+#CRC: YES
+#Layer: 3
+#Bit Rate: All except Free format
+#VBR: Yes
+#Payload Format: RFC-2250
+MP3_CAPABILITIES = dbus.Array([dbus.Byte(0x3f), dbus.Byte(0x07), dbus.Byte(0xff), dbus.Byte(0xfe)])
+# JointStereo 44.1Khz Layer: 3 Bit Rate: VBR Format: RFC-2250
+MP3_CONFIGURATION = dbus.Array([dbus.Byte(0x21), dbus.Byte(0x02), dbus.Byte(0x00), dbus.Byte(0x80)])
+
+PCM_CODEC = dbus.Byte(0x00)
+PCM_CONFIGURATION = dbus.Array([], signature="ay")
+
+CVSD_CODEC = dbus.Byte(0x01)
+
+class Rejected(dbus.DBusException):
+ _dbus_error_name = "org.bluez.Error.Rejected"
+
+class InvalidArgsException(dbus.exceptions.DBusException):
+ _dbus_error_name = 'org.freedesktop.DBus.Error.InvalidArgs'
+
+class Endpoint(dbus.service.Object):
+ def __init__(self, bus, path, properties, configuration):
+ self.path = path
+ self.bus = bus
+ self.properties = properties
+ self.configuration = configuration
+ self.exit_on_release = True
+ dbus.service.Object.__init__(self, bus, self.path)
+
+ def get_properties(self):
+ return self.properties
+
+ def get_path(self):
+ return dbus.ObjectPath(self.path)
+
+ @dbus.service.method(DBUS_PROP_IFACE, in_signature='s',
+ out_signature='a{sv}')
+ def GetAll(self, interface):
+ if interface != ENDPOINT_IFACE:
+ raise InvalidArgsException()
+
+ return self.get_properties()
+
+ def set_exit_on_release(self, exit_on_release):
+ self.exit_on_release = exit_on_release
+
+ def default_configuration(self, configuration):
+ self.configuration = configuration
+
+ @dbus.service.method(ENDPOINT_IFACE, in_signature="", out_signature="")
+ def Release(self):
+ print("Release")
+ if self.exit_on_release:
+ mainloop.quit()
+
+ @dbus.service.method(ENDPOINT_IFACE, in_signature="o", out_signature="")
+ def ClearConfiguration(self, transport):
+ print("ClearConfiguration (%s)" % (transport))
+
+ @dbus.service.method(ENDPOINT_IFACE, in_signature="oay", out_signature="")
+ def SetConfiguration(self, transport, config):
+ print("SetConfiguration (%s, %s)" % (transport, config))
+ return
+
+ @dbus.service.method(ENDPOINT_IFACE, in_signature="ay", out_signature="ay")
+ def SelectConfiguration(self, caps):
+ print("SelectConfiguration (%s)" % (caps))
+ return self.configuration
+
+class Application(dbus.service.Object):
+ def __init__(self, bus, path, properties, configuration):
+ self.path = '/'
+ self.endpoints = []
+ dbus.service.Object.__init__(self, bus, self.path)
+ self.add_endpoint(Endpoint(bus, path, properties, configuration))
+
+ def get_path(self):
+ return dbus.ObjectPath(self.path)
+
+ def add_endpoint(self, endpoint):
+ self.endpoints.append(endpoint)
+
+ @dbus.service.method(DBUS_OM_IFACE, out_signature='a{oa{sa{sv}}}')
+ def GetManagedObjects(self):
+ response = {}
+ print('GetManagedObjects')
+
+ for endpoint in self.endpoints:
+ response[endpoint.get_path()] = { ENDPOINT_IFACE:
+ endpoint.get_properties() }
+
+ return response
+
+def register_app_cb():
+ print('Media application registered')
+
+
+def register_app_error_cb(error):
+ print('Failed to register application: ' + str(error))
+ mainloop.quit()
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+
+ if len(sys.argv) > 1:
+ path = bluezutils.find_adapter(sys.argv[1]).object_path
+ else:
+ path = bluezutils.find_adapter().object_path
+
+ media = dbus.Interface(bus.get_object("org.bluez", path),
+ "org.bluez.Media1")
+
+
+ properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID,
+ "Codec" : SBC_CODEC,
+ "DelayReporting" : True,
+ "Capabilities" : SBC_CAPABILITIES })
+
+ configuration = SBC_CONFIGURATION
+
+ if len(sys.argv) > 2:
+ if sys.argv[2] == "sbcsink":
+ properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID,
+ "Codec" : SBC_CODEC,
+ "DelayReporting" : True,
+ "Capabilities" : SBC_CAPABILITIES })
+ if sys.argv[2] == "mp3source":
+ properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID,
+ "Codec" : MP3_CODEC,
+ "Capabilities" : MP3_CAPABILITIES })
+ configuration = MP3_CONFIGURATION
+ if sys.argv[2] == "mp3sink":
+ properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID,
+ "Codec" : MP3_CODEC,
+ "Capabilities" : MP3_CAPABILITIES })
+ configuration = MP3_CONFIGURATION
+
+ print(properties)
+
+ path = "/test/endpoint"
+ app = Application(bus, path, properties, configuration)
+ mainloop = GObject.MainLoop()
+
+ media.RegisterApplication(app.get_path(), {},
+ reply_handler=register_app_cb,
+ error_handler=register_app_error_cb)
+ mainloop.run()
--
2.21.0

2019-07-13 14:53:37

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi Pali,

On Fri, Jul 12, 2019 at 6:13 PM Luiz Augusto von Dentz
<[email protected]> wrote:
>
> From: Luiz Augusto von Dentz <[email protected]>
>
> This uses application ObjectManager to discover the MediaEndpoint and
> MediaPlayer object of an application and deprecates the use of
> RegisterEndpoint and RegisterPlayer.
> ---
> doc/media-api.txt | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/doc/media-api.txt b/doc/media-api.txt
> index bca8c9563..07f7ac3e0 100644
> --- a/doc/media-api.txt
> +++ b/doc/media-api.txt
> @@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties)
>
> Unregister sender media player.
>
> + void RegisterApplication(object root, dict options)
>
> + Register endpoints an player objects within root
> + object which must implement ObjectManager.
> +
> + The application object path together with the D-Bus
> + system bus connection ID define the identification of
> + the application.
> +
> + Possible errors: org.bluez.Error.InvalidArguments
> + org.bluez.Error.AlreadyExists
> +
> + void UnregisterApplication(object application)
> +
> + This unregisters the services that has been
> + previously registered. The object path parameter
> + must match the same value that has been used
> + on registration.
> +
> + Possible errors: org.bluez.Error.InvalidArguments
> + org.bluez.Error.DoesNotExist
> Media Control hierarchy
> =======================
>
> --
> 2.21.0

Can you try this set?


--
Luiz Augusto von Dentz

2019-07-18 10:01:12

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Fri, Jul 12, 2019 at 6:13 PM Luiz Augusto von Dentz
> <[email protected]> wrote:
> >
> > From: Luiz Augusto von Dentz <[email protected]>
> >
> > This uses application ObjectManager to discover the MediaEndpoint and
> > MediaPlayer object of an application and deprecates the use of
> > RegisterEndpoint and RegisterPlayer.
> > ---
> > doc/media-api.txt | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> > diff --git a/doc/media-api.txt b/doc/media-api.txt
> > index bca8c9563..07f7ac3e0 100644
> > --- a/doc/media-api.txt
> > +++ b/doc/media-api.txt
> > @@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties)
> >
> > Unregister sender media player.
> >
> > + void RegisterApplication(object root, dict options)
> >
> > + Register endpoints an player objects within root
> > + object which must implement ObjectManager.
> > +
> > + The application object path together with the D-Bus
> > + system bus connection ID define the identification of
> > + the application.
> > +
> > + Possible errors: org.bluez.Error.InvalidArguments
> > + org.bluez.Error.AlreadyExists
> > +
> > + void UnregisterApplication(object application)
> > +
> > + This unregisters the services that has been
> > + previously registered. The object path parameter
> > + must match the same value that has been used
> > + on registration.
> > +
> > + Possible errors: org.bluez.Error.InvalidArguments
> > + org.bluez.Error.DoesNotExist
> > Media Control hierarchy
> > =======================
> >
> > --
> > 2.21.0
>
> Can you try this set?

Hello, I will try it later in next week. To test it would mean to
rewrite pulseaudio bluetooth modules to use this new API, so it would
take me longer time.

--
Pali Rohár
[email protected]

2019-07-21 15:59:08

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Thursday 18 July 2019 12:00:24 Pali Rohár wrote:
> On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Fri, Jul 12, 2019 at 6:13 PM Luiz Augusto von Dentz
> > <[email protected]> wrote:
> > >
> > > From: Luiz Augusto von Dentz <[email protected]>
> > >
> > > This uses application ObjectManager to discover the MediaEndpoint and
> > > MediaPlayer object of an application and deprecates the use of
> > > RegisterEndpoint and RegisterPlayer.
> > > ---
> > > doc/media-api.txt | 20 ++++++++++++++++++++
> > > 1 file changed, 20 insertions(+)
> > >
> > > diff --git a/doc/media-api.txt b/doc/media-api.txt
> > > index bca8c9563..07f7ac3e0 100644
> > > --- a/doc/media-api.txt
> > > +++ b/doc/media-api.txt
> > > @@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties)
> > >
> > > Unregister sender media player.
> > >
> > > + void RegisterApplication(object root, dict options)
> > >
> > > + Register endpoints an player objects within root
> > > + object which must implement ObjectManager.
> > > +
> > > + The application object path together with the D-Bus
> > > + system bus connection ID define the identification of
> > > + the application.
> > > +
> > > + Possible errors: org.bluez.Error.InvalidArguments
> > > + org.bluez.Error.AlreadyExists
> > > +
> > > + void UnregisterApplication(object application)
> > > +
> > > + This unregisters the services that has been
> > > + previously registered. The object path parameter
> > > + must match the same value that has been used
> > > + on registration.
> > > +
> > > + Possible errors: org.bluez.Error.InvalidArguments
> > > + org.bluez.Error.DoesNotExist
> > > Media Control hierarchy
> > > =======================
> > >
> > > --
> > > 2.21.0
> >
> > Can you try this set?
>
> Hello, I will try it later in next week. To test it would mean to
> rewrite pulseaudio bluetooth modules to use this new API, so it would
> take me longer time.

Hi! I looked at it. But I do not know how to implement
GetManagedObjects() method via libdbus properly. Any idea?

--
Pali Rohár
[email protected]


Attachments:
(No filename) (2.52 kB)
signature.asc (201.00 B)
Download all attachments

2019-08-10 06:56:05

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi,

On Sun, Jul 21, 2019 at 6:55 PM Pali Rohár <[email protected]> wrote:
>
> On Thursday 18 July 2019 12:00:24 Pali Rohár wrote:
> > On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
> > > Hi Pali,
> > >
> > > On Fri, Jul 12, 2019 at 6:13 PM Luiz Augusto von Dentz
> > > <[email protected]> wrote:
> > > >
> > > > From: Luiz Augusto von Dentz <[email protected]>
> > > >
> > > > This uses application ObjectManager to discover the MediaEndpoint and
> > > > MediaPlayer object of an application and deprecates the use of
> > > > RegisterEndpoint and RegisterPlayer.
> > > > ---
> > > > doc/media-api.txt | 20 ++++++++++++++++++++
> > > > 1 file changed, 20 insertions(+)
> > > >
> > > > diff --git a/doc/media-api.txt b/doc/media-api.txt
> > > > index bca8c9563..07f7ac3e0 100644
> > > > --- a/doc/media-api.txt
> > > > +++ b/doc/media-api.txt
> > > > @@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties)
> > > >
> > > > Unregister sender media player.
> > > >
> > > > + void RegisterApplication(object root, dict options)
> > > >
> > > > + Register endpoints an player objects within root
> > > > + object which must implement ObjectManager.
> > > > +
> > > > + The application object path together with the D-Bus
> > > > + system bus connection ID define the identification of
> > > > + the application.
> > > > +
> > > > + Possible errors: org.bluez.Error.InvalidArguments
> > > > + org.bluez.Error.AlreadyExists
> > > > +
> > > > + void UnregisterApplication(object application)
> > > > +
> > > > + This unregisters the services that has been
> > > > + previously registered. The object path parameter
> > > > + must match the same value that has been used
> > > > + on registration.
> > > > +
> > > > + Possible errors: org.bluez.Error.InvalidArguments
> > > > + org.bluez.Error.DoesNotExist
> > > > Media Control hierarchy
> > > > =======================
> > > >
> > > > --
> > > > 2.21.0
> > >
> > > Can you try this set?
> >
> > Hello, I will try it later in next week. To test it would mean to
> > rewrite pulseaudio bluetooth modules to use this new API, so it would
> > take me longer time.
>
> Hi! I looked at it. But I do not know how to implement
> GetManagedObjects() method via libdbus properly. Any idea?

I went ahead and applied this set, you can find some examples of how
to implement ObjectManager interface in gdbus but I guess what you
really need to do is make PA aware of the objects being exposed since
it does make it simpler to to enumerate objects by the clients.

--
Luiz Augusto von Dentz

2019-08-29 13:07:24

by Pasi Kärkkäinen

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi,

On Sat, Aug 10, 2019 at 09:54:52AM +0300, Luiz Augusto von Dentz wrote:
> Hi,
>
> On Sun, Jul 21, 2019 at 6:55 PM Pali Roh?r <[email protected]> wrote:
> >
> > On Thursday 18 July 2019 12:00:24 Pali Roh?r wrote:
> > > On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
> > > > Hi Pali,
> > > >
> > > > On Fri, Jul 12, 2019 at 6:13 PM Luiz Augusto von Dentz
> > > > <[email protected]> wrote:
> > > > >
> > > > > From: Luiz Augusto von Dentz <[email protected]>
> > > > >
> > > > > This uses application ObjectManager to discover the MediaEndpoint and
> > > > > MediaPlayer object of an application and deprecates the use of
> > > > > RegisterEndpoint and RegisterPlayer.
> > > > > ---
> > > > > doc/media-api.txt | 20 ++++++++++++++++++++
> > > > > 1 file changed, 20 insertions(+)
> > > > >
> > > > > diff --git a/doc/media-api.txt b/doc/media-api.txt
> > > > > index bca8c9563..07f7ac3e0 100644
> > > > > --- a/doc/media-api.txt
> > > > > +++ b/doc/media-api.txt
> > > > > @@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties)
> > > > >
> > > > > Unregister sender media player.
> > > > >
> > > > > + void RegisterApplication(object root, dict options)
> > > > >
> > > > > + Register endpoints an player objects within root
> > > > > + object which must implement ObjectManager.
> > > > > +
> > > > > + The application object path together with the D-Bus
> > > > > + system bus connection ID define the identification of
> > > > > + the application.
> > > > > +
> > > > > + Possible errors: org.bluez.Error.InvalidArguments
> > > > > + org.bluez.Error.AlreadyExists
> > > > > +
> > > > > + void UnregisterApplication(object application)
> > > > > +
> > > > > + This unregisters the services that has been
> > > > > + previously registered. The object path parameter
> > > > > + must match the same value that has been used
> > > > > + on registration.
> > > > > +
> > > > > + Possible errors: org.bluez.Error.InvalidArguments
> > > > > + org.bluez.Error.DoesNotExist
> > > > > Media Control hierarchy
> > > > > =======================
> > > > >
> > > > > --
> > > > > 2.21.0
> > > >
> > > > Can you try this set?
> > >
> > > Hello, I will try it later in next week. To test it would mean to
> > > rewrite pulseaudio bluetooth modules to use this new API, so it would
> > > take me longer time.
> >
> > Hi! I looked at it. But I do not know how to implement
> > GetManagedObjects() method via libdbus properly. Any idea?
>
> I went ahead and applied this set, you can find some examples of how
> to implement ObjectManager interface in gdbus but I guess what you
> really need to do is make PA aware of the objects being exposed since
> it does make it simpler to to enumerate objects by the clients.
>

Pali: How does it look with porting the PA patches to use the new interfaces?


Thanks,

-- Pasi

2019-08-29 20:05:41

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> Pali: How does it look with porting the PA patches to use the new interfaces?

Hello, I have not had a time yet to play with these pulseaudio patches
and porting to the new interface. I guess that I could have more free
time in the last week of next month.

--
Pali Rohár
[email protected]


Attachments:
(No filename) (368.00 B)
signature.asc (201.00 B)
Download all attachments

2019-10-03 19:01:10

by Pasi Kärkkäinen

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi,

On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Roh?r wrote:
> On Thursday 29 August 2019 15:57:34 Pasi K?rkk?inen wrote:
> > Pali: How does it look with porting the PA patches to use the new interfaces?
>
> Hello, I have not had a time yet to play with these pulseaudio patches
> and porting to the new interface. I guess that I could have more free
> time in the last week of next month.
>

It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.


-- Pasi

> --
> Pali Roh?r
> [email protected]

2019-10-06 10:08:27

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> Hi,
>
> On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > Pali: How does it look with porting the PA patches to use the new interfaces?
> >
> > Hello, I have not had a time yet to play with these pulseaudio patches
> > and porting to the new interface. I guess that I could have more free
> > time in the last week of next month.
> >
>
> It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> So now at least the new interfaces are in a released bluez version.

Ok! Today I have looked at this new Bluez API, but seems that there is
not only missing some examples or usages with libdbus-1, but also
documentation. I have tried to find something how to register endpoints
throw GetManagedObjects() via libdbus-1, but seems that there is no
usage of it and also unusable documentation for it in libdbus-1. So
currently I'm stuck how to use this exotic API in pulseaudio...

--
Pali Rohár
[email protected]


Attachments:
(No filename) (1.10 kB)
signature.asc (201.00 B)
Download all attachments

2019-10-06 10:54:34

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi Pali,

On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
>
> On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > Hi,
> >
> > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > >
> > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > and porting to the new interface. I guess that I could have more free
> > > time in the last week of next month.
> > >
> >
> > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > So now at least the new interfaces are in a released bluez version.
>
> Ok! Today I have looked at this new Bluez API, but seems that there is
> not only missing some examples or usages with libdbus-1, but also
> documentation. I have tried to find something how to register endpoints
> throw GetManagedObjects() via libdbus-1, but seems that there is no
> usage of it and also unusable documentation for it in libdbus-1. So
> currently I'm stuck how to use this exotic API in pulseaudio...

It is just another D-Bus method, the only difference is that it
carries the entire object tree, btw I did add an example of how to
register Endpoints in python:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint

You can also have a look at how our gdbus internal library (uses
libdbus) utilize it:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269

--
Luiz Augusto von Dentz

2019-10-06 10:57:24

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> >
> > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > Hi,
> > >
> > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > >
> > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > and porting to the new interface. I guess that I could have more free
> > > > time in the last week of next month.
> > > >
> > >
> > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > So now at least the new interfaces are in a released bluez version.
> >
> > Ok! Today I have looked at this new Bluez API, but seems that there is
> > not only missing some examples or usages with libdbus-1, but also
> > documentation. I have tried to find something how to register endpoints
> > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > usage of it and also unusable documentation for it in libdbus-1. So
> > currently I'm stuck how to use this exotic API in pulseaudio...
>
> It is just another D-Bus method, the only difference is that it
> carries the entire object tree, btw I did add an example of how to
> register Endpoints in python:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint

Now I found this python example and currently I'm doing observations and
"reverse-engineering" how it is working and how this example behaves on
D-Bus. I think I understood it now.

> You can also have a look at how our gdbus internal library (uses
> libdbus) utilize it:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
>

--
Pali Rohár
[email protected]


Attachments:
(No filename) (1.95 kB)
signature.asc (201.00 B)
Download all attachments

2019-10-06 11:15:11

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi Pali,

On Sun, Oct 6, 2019 at 1:56 PM Pali Rohár <[email protected]> wrote:
>
> On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > >
> > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > Hi,
> > > >
> > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > >
> > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > and porting to the new interface. I guess that I could have more free
> > > > > time in the last week of next month.
> > > > >
> > > >
> > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > So now at least the new interfaces are in a released bluez version.
> > >
> > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > not only missing some examples or usages with libdbus-1, but also
> > > documentation. I have tried to find something how to register endpoints
> > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > usage of it and also unusable documentation for it in libdbus-1. So
> > > currently I'm stuck how to use this exotic API in pulseaudio...
> >
> > It is just another D-Bus method, the only difference is that it
> > carries the entire object tree, btw I did add an example of how to
> > register Endpoints in python:
> >
> > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
>
> Now I found this python example and currently I'm doing observations and
> "reverse-engineering" how it is working and how this example behaves on
> D-Bus. I think I understood it now.

One important detail is that RegisterApplication shall not block since
the daemon will call GetManagedObjects the D-Bus mainloop must be able
to process messages.

> > You can also have a look at how our gdbus internal library (uses
> > libdbus) utilize it:
> >
> > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> >
>
> --
> Pali Rohár
> [email protected]



--
Luiz Augusto von Dentz

2019-10-06 11:17:59

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Sunday 06 October 2019 14:14:18 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Sun, Oct 6, 2019 at 1:56 PM Pali Rohár <[email protected]> wrote:
> >
> > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > Hi Pali,
> > >
> > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > >
> > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > >
> > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > time in the last week of next month.
> > > > > >
> > > > >
> > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > So now at least the new interfaces are in a released bluez version.
> > > >
> > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > not only missing some examples or usages with libdbus-1, but also
> > > > documentation. I have tried to find something how to register endpoints
> > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > >
> > > It is just another D-Bus method, the only difference is that it
> > > carries the entire object tree, btw I did add an example of how to
> > > register Endpoints in python:
> > >
> > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> >
> > Now I found this python example and currently I'm doing observations and
> > "reverse-engineering" how it is working and how this example behaves on
> > D-Bus. I think I understood it now.
>
> One important detail is that RegisterApplication shall not block since
> the daemon will call GetManagedObjects the D-Bus mainloop must be able
> to process messages.

Ok. I'm already using non-blocking / async processing as blocking
variants can cause more problems in event-orientated applications.

> > > You can also have a look at how our gdbus internal library (uses
> > > libdbus) utilize it:
> > >
> > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > >
> >
> > --
> > Pali Rohár
> > [email protected]
>
>
>

--
Pali Rohár
[email protected]


Attachments:
(No filename) (2.63 kB)
signature.asc (201.00 B)
Download all attachments

2019-10-06 12:04:27

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> >
> > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > Hi,
> > >
> > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > >
> > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > and porting to the new interface. I guess that I could have more free
> > > > time in the last week of next month.
> > > >
> > >
> > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > So now at least the new interfaces are in a released bluez version.
> >
> > Ok! Today I have looked at this new Bluez API, but seems that there is
> > not only missing some examples or usages with libdbus-1, but also
> > documentation. I have tried to find something how to register endpoints
> > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > usage of it and also unusable documentation for it in libdbus-1. So
> > currently I'm stuck how to use this exotic API in pulseaudio...
>
> It is just another D-Bus method, the only difference is that it
> carries the entire object tree, btw I did add an example of how to
> register Endpoints in python:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint

This example uses undocumented property "DelayReporting". What it is doing?

> You can also have a look at how our gdbus internal library (uses
> libdbus) utilize it:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
>

--
Pali Rohár
[email protected]


Attachments:
(No filename) (1.84 kB)
signature.asc (201.00 B)
Download all attachments

2019-10-06 18:04:25

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Sunday 06 October 2019 13:17:00 Pali Rohár wrote:
> On Sunday 06 October 2019 14:14:18 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Sun, Oct 6, 2019 at 1:56 PM Pali Rohár <[email protected]> wrote:
> > >
> > > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > > Hi Pali,
> > > >
> > > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > > >
> > > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > > >
> > > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > > time in the last week of next month.
> > > > > > >
> > > > > >
> > > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > > So now at least the new interfaces are in a released bluez version.
> > > > >
> > > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > > not only missing some examples or usages with libdbus-1, but also
> > > > > documentation. I have tried to find something how to register endpoints
> > > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > > >
> > > > It is just another D-Bus method, the only difference is that it
> > > > carries the entire object tree, btw I did add an example of how to
> > > > register Endpoints in python:
> > > >
> > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> > >
> > > Now I found this python example and currently I'm doing observations and
> > > "reverse-engineering" how it is working and how this example behaves on
> > > D-Bus. I think I understood it now.
> >
> > One important detail is that RegisterApplication shall not block since
> > the daemon will call GetManagedObjects the D-Bus mainloop must be able
> > to process messages.
>
> Ok. I'm already using non-blocking / async processing as blocking
> variants can cause more problems in event-orientated applications.

Now I implemented it in pulseaudio. New patches are now available in
[email protected] mailing list.

> > > > You can also have a look at how our gdbus internal library (uses
> > > > libdbus) utilize it:
> > > >
> > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > > >
> > >
> > > --
> > > Pali Rohár
> > > [email protected]
> >
> >
> >
>

--
Pali Rohár
[email protected]


Attachments:
(No filename) (2.93 kB)
signature.asc (201.00 B)
Download all attachments

2019-10-07 14:34:11

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > >
> > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > Hi,
> > > >
> > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > >
> > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > and porting to the new interface. I guess that I could have more free
> > > > > time in the last week of next month.
> > > > >
> > > >
> > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > So now at least the new interfaces are in a released bluez version.
> > >
> > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > not only missing some examples or usages with libdbus-1, but also
> > > documentation. I have tried to find something how to register endpoints
> > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > usage of it and also unusable documentation for it in libdbus-1. So
> > > currently I'm stuck how to use this exotic API in pulseaudio...
> >
> > It is just another D-Bus method, the only difference is that it
> > carries the entire object tree, btw I did add an example of how to
> > register Endpoints in python:
> >
> > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
>
> This example uses undocumented property "DelayReporting". What it is doing?

Also this new Managed Objects API bring some inconsistency. Codec
switching API is available only when bluetoothd was started with
--experimental flag, but this new Object API is available also without
it. So it just complicated implementation.

How could application (e.g. pulseaudio) check if A2DP codec switching is
available and based on this decide if via Managed Objects API export
more codecs or just only default SBC?

> > You can also have a look at how our gdbus internal library (uses
> > libdbus) utilize it:
> >
> > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> >
>

--
Pali Rohár
[email protected]

2019-10-08 10:30:42

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi Pali,

On Mon, Oct 7, 2019 at 5:33 PM Pali Rohár <[email protected]> wrote:
>
> On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > Hi Pali,
> > >
> > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > >
> > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > >
> > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > time in the last week of next month.
> > > > > >
> > > > >
> > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > So now at least the new interfaces are in a released bluez version.
> > > >
> > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > not only missing some examples or usages with libdbus-1, but also
> > > > documentation. I have tried to find something how to register endpoints
> > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > >
> > > It is just another D-Bus method, the only difference is that it
> > > carries the entire object tree, btw I did add an example of how to
> > > register Endpoints in python:
> > >
> > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> >
> > This example uses undocumented property "DelayReporting". What it is doing?
>
> Also this new Managed Objects API bring some inconsistency. Codec
> switching API is available only when bluetoothd was started with
> --experimental flag, but this new Object API is available also without
> it. So it just complicated implementation.
>
> How could application (e.g. pulseaudio) check if A2DP codec switching is
> available and based on this decide if via Managed Objects API export
> more codecs or just only default SBC?

The idea was that this API would be experimental as well but it seems
it is not, they should go hand in hand with Endpoint objects to ensure
they will be available as well so we might have to fix this in 5.52,
too bad we didn't see this before 5.51 went out.

> > > You can also have a look at how our gdbus internal library (uses
> > > libdbus) utilize it:
> > >
> > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > >
> >
>
> --
> Pali Rohár
> [email protected]



--
Luiz Augusto von Dentz

2019-10-08 10:34:11

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Mon, Oct 7, 2019 at 5:33 PM Pali Rohár <[email protected]> wrote:
> >
> > On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > > Hi Pali,
> > > >
> > > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > > >
> > > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > > >
> > > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > > time in the last week of next month.
> > > > > > >
> > > > > >
> > > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > > So now at least the new interfaces are in a released bluez version.
> > > > >
> > > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > > not only missing some examples or usages with libdbus-1, but also
> > > > > documentation. I have tried to find something how to register endpoints
> > > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > > >
> > > > It is just another D-Bus method, the only difference is that it
> > > > carries the entire object tree, btw I did add an example of how to
> > > > register Endpoints in python:
> > > >
> > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> > >
> > > This example uses undocumented property "DelayReporting". What it is doing?
> >
> > Also this new Managed Objects API bring some inconsistency. Codec
> > switching API is available only when bluetoothd was started with
> > --experimental flag, but this new Object API is available also without
> > it. So it just complicated implementation.
> >
> > How could application (e.g. pulseaudio) check if A2DP codec switching is
> > available and based on this decide if via Managed Objects API export
> > more codecs or just only default SBC?
>
> The idea was that this API would be experimental as well but it seems
> it is not,

No, it is not experimental. Managed Objects API is available also when
bluetoothd is started without --experimental argument.

> they should go hand in hand with Endpoint objects to ensure
> they will be available as well so we might have to fix this in 5.52,
> too bad we didn't see this before 5.51 went out.

So... what should applications expects and how they should implement
above decision?

> > > > You can also have a look at how our gdbus internal library (uses
> > > > libdbus) utilize it:
> > > >
> > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > > >
> > >
> >
> > --
> > Pali Rohár
> > [email protected]
>
>
>

--
Pali Rohár
[email protected]

2019-10-09 13:16:44

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi Pali,

On Tue, Oct 8, 2019 at 1:33 PM Pali Rohár <[email protected]> wrote:
>
> On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Mon, Oct 7, 2019 at 5:33 PM Pali Rohár <[email protected]> wrote:
> > >
> > > On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > > > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > > > Hi Pali,
> > > > >
> > > > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > > > >
> > > > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > > > >
> > > > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > > > time in the last week of next month.
> > > > > > > >
> > > > > > >
> > > > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > > > So now at least the new interfaces are in a released bluez version.
> > > > > >
> > > > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > > > not only missing some examples or usages with libdbus-1, but also
> > > > > > documentation. I have tried to find something how to register endpoints
> > > > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > > > >
> > > > > It is just another D-Bus method, the only difference is that it
> > > > > carries the entire object tree, btw I did add an example of how to
> > > > > register Endpoints in python:
> > > > >
> > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> > > >
> > > > This example uses undocumented property "DelayReporting". What it is doing?
> > >
> > > Also this new Managed Objects API bring some inconsistency. Codec
> > > switching API is available only when bluetoothd was started with
> > > --experimental flag, but this new Object API is available also without
> > > it. So it just complicated implementation.
> > >
> > > How could application (e.g. pulseaudio) check if A2DP codec switching is
> > > available and based on this decide if via Managed Objects API export
> > > more codecs or just only default SBC?
> >
> > The idea was that this API would be experimental as well but it seems
> > it is not,
>
> No, it is not experimental. Managed Objects API is available also when
> bluetoothd is started without --experimental argument.
>
> > they should go hand in hand with Endpoint objects to ensure
> > they will be available as well so we might have to fix this in 5.52,
> > too bad we didn't see this before 5.51 went out.
>
> So... what should applications expects and how they should implement
> above decision?

Actually the decision should be based on the presence of
RegisterApplication method, if that exists then endpoint switching
should be supported as well, so has nothing to do the
GetManagedObjects API of the bluetoothd. That said RegisterApplication
was not made experimental which kind makes 5.51 broken because it
would appear that it endpoint objects would be exposed but when in
fact there are not, anyway lets finally have the code to use this
interface and then we can remove the experimental flag from
MediaEndpoint.

> > > > > You can also have a look at how our gdbus internal library (uses
> > > > > libdbus) utilize it:
> > > > >
> > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > > > >
> > > >
> > >
> > > --
> > > Pali Rohár
> > > [email protected]
> >
> >
> >
>
> --
> Pali Rohár
> [email protected]



--
Luiz Augusto von Dentz

2019-10-09 13:21:14

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > >
> > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > Hi,
> > > >
> > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > >
> > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > and porting to the new interface. I guess that I could have more free
> > > > > time in the last week of next month.
> > > > >
> > > >
> > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > So now at least the new interfaces are in a released bluez version.
> > >
> > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > not only missing some examples or usages with libdbus-1, but also
> > > documentation. I have tried to find something how to register endpoints
> > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > usage of it and also unusable documentation for it in libdbus-1. So
> > > currently I'm stuck how to use this exotic API in pulseaudio...
> >
> > It is just another D-Bus method, the only difference is that it
> > carries the entire object tree, btw I did add an example of how to
> > register Endpoints in python:
> >
> > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
>
> This example uses undocumented property "DelayReporting". What it is doing?

And I would like to know what is that undocumented DelayReporting is
doing? And to which value should I initialize it in pulseaudio?

> > You can also have a look at how our gdbus internal library (uses
> > libdbus) utilize it:
> >
> > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> >
>

--
Pali Rohár
[email protected]

2019-10-09 13:21:58

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Wednesday 09 October 2019 16:15:59 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Tue, Oct 8, 2019 at 1:33 PM Pali Rohár <[email protected]> wrote:
> >
> > On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
> > > Hi Pali,
> > >
> > > On Mon, Oct 7, 2019 at 5:33 PM Pali Rohár <[email protected]> wrote:
> > > >
> > > > On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > > > > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > > > > Hi Pali,
> > > > > >
> > > > > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > > > > >
> > > > > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > > > > >
> > > > > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > > > > time in the last week of next month.
> > > > > > > > >
> > > > > > > >
> > > > > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > > > > So now at least the new interfaces are in a released bluez version.
> > > > > > >
> > > > > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > > > > not only missing some examples or usages with libdbus-1, but also
> > > > > > > documentation. I have tried to find something how to register endpoints
> > > > > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > > > > >
> > > > > > It is just another D-Bus method, the only difference is that it
> > > > > > carries the entire object tree, btw I did add an example of how to
> > > > > > register Endpoints in python:
> > > > > >
> > > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> > > > >
> > > > > This example uses undocumented property "DelayReporting". What it is doing?
> > > >
> > > > Also this new Managed Objects API bring some inconsistency. Codec
> > > > switching API is available only when bluetoothd was started with
> > > > --experimental flag, but this new Object API is available also without
> > > > it. So it just complicated implementation.
> > > >
> > > > How could application (e.g. pulseaudio) check if A2DP codec switching is
> > > > available and based on this decide if via Managed Objects API export
> > > > more codecs or just only default SBC?
> > >
> > > The idea was that this API would be experimental as well but it seems
> > > it is not,
> >
> > No, it is not experimental. Managed Objects API is available also when
> > bluetoothd is started without --experimental argument.
> >
> > > they should go hand in hand with Endpoint objects to ensure
> > > they will be available as well so we might have to fix this in 5.52,
> > > too bad we didn't see this before 5.51 went out.
> >
> > So... what should applications expects and how they should implement
> > above decision?
>
> Actually the decision should be based on the presence of
> RegisterApplication method, if that exists then endpoint switching
> should be supported as well, so has nothing to do the
> GetManagedObjects API of the bluetoothd. That said RegisterApplication
> was not made experimental which kind makes 5.51 broken because it
> would appear that it endpoint objects would be exposed but when in
> fact there are not, anyway lets finally have the code to use this
> interface and then we can remove the experimental flag from
> MediaEndpoint.

Ok, so can pulseaudio do following?

Call RegisterApplication. If success then expects that codec switching
is possible and via GetManagedObjects exports all available codecs.
If RegisterApplication fails then fallback to RegisterEndpoint, expects
that codec switching is not possible and so register only one SBC codec.

> > > > > > You can also have a look at how our gdbus internal library (uses
> > > > > > libdbus) utilize it:
> > > > > >
> > > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > > > > >
> > > > >
> > > >
> > > > --
> > > > Pali Rohár
> > > > [email protected]
> > >
> > >
> > >
> >
> > --
> > Pali Rohár
> > [email protected]
>
>
>

--
Pali Rohár
[email protected]

2019-10-18 14:05:13

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Wednesday 09 October 2019 15:19:21 Pali Rohár wrote:
> On Wednesday 09 October 2019 16:15:59 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Tue, Oct 8, 2019 at 1:33 PM Pali Rohár <[email protected]> wrote:
> > >
> > > On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
> > > > Hi Pali,
> > > >
> > > > On Mon, Oct 7, 2019 at 5:33 PM Pali Rohár <[email protected]> wrote:
> > > > >
> > > > > On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > > > > > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > > > > > Hi Pali,
> > > > > > >
> > > > > > > On Sun, Oct 6, 2019 at 1:05 PM Pali Rohár <[email protected]> wrote:
> > > > > > > >
> > > > > > > > On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > On Thu, Aug 29, 2019 at 10:05:13PM +0200, Pali Rohár wrote:
> > > > > > > > > > On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
> > > > > > > > > > > Pali: How does it look with porting the PA patches to use the new interfaces?
> > > > > > > > > >
> > > > > > > > > > Hello, I have not had a time yet to play with these pulseaudio patches
> > > > > > > > > > and porting to the new interface. I guess that I could have more free
> > > > > > > > > > time in the last week of next month.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
> > > > > > > > > So now at least the new interfaces are in a released bluez version.
> > > > > > > >
> > > > > > > > Ok! Today I have looked at this new Bluez API, but seems that there is
> > > > > > > > not only missing some examples or usages with libdbus-1, but also
> > > > > > > > documentation. I have tried to find something how to register endpoints
> > > > > > > > throw GetManagedObjects() via libdbus-1, but seems that there is no
> > > > > > > > usage of it and also unusable documentation for it in libdbus-1. So
> > > > > > > > currently I'm stuck how to use this exotic API in pulseaudio...
> > > > > > >
> > > > > > > It is just another D-Bus method, the only difference is that it
> > > > > > > carries the entire object tree, btw I did add an example of how to
> > > > > > > register Endpoints in python:
> > > > > > >
> > > > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> > > > > >
> > > > > > This example uses undocumented property "DelayReporting". What it is doing?
> > > > >
> > > > > Also this new Managed Objects API bring some inconsistency. Codec
> > > > > switching API is available only when bluetoothd was started with
> > > > > --experimental flag, but this new Object API is available also without
> > > > > it. So it just complicated implementation.
> > > > >
> > > > > How could application (e.g. pulseaudio) check if A2DP codec switching is
> > > > > available and based on this decide if via Managed Objects API export
> > > > > more codecs or just only default SBC?
> > > >
> > > > The idea was that this API would be experimental as well but it seems
> > > > it is not,
> > >
> > > No, it is not experimental. Managed Objects API is available also when
> > > bluetoothd is started without --experimental argument.
> > >
> > > > they should go hand in hand with Endpoint objects to ensure
> > > > they will be available as well so we might have to fix this in 5.52,
> > > > too bad we didn't see this before 5.51 went out.
> > >
> > > So... what should applications expects and how they should implement
> > > above decision?
> >
> > Actually the decision should be based on the presence of
> > RegisterApplication method, if that exists then endpoint switching
> > should be supported as well, so has nothing to do the
> > GetManagedObjects API of the bluetoothd. That said RegisterApplication
> > was not made experimental which kind makes 5.51 broken because it
> > would appear that it endpoint objects would be exposed but when in
> > fact there are not, anyway lets finally have the code to use this
> > interface and then we can remove the experimental flag from
> > MediaEndpoint.
>
> Ok, so can pulseaudio do following?
>
> Call RegisterApplication. If success then expects that codec switching
> is possible and via GetManagedObjects exports all available codecs.
> If RegisterApplication fails then fallback to RegisterEndpoint, expects
> that codec switching is not possible and so register only one SBC codec.

Also can we solve this problem in bluez ASAP? Last released bluez
version is due to that non-experimental API broken and once applications
(e.g. pulseaudio) starts using this new API then A2DP without bluetoothd
-E would be broken.

I would propose to remove experimental mark for codec switching API and
release a new bugfix version of bluez, so people would not use released
5.51 broken version... which could prevent breakage of A2DP in future.

> > > > > > > You can also have a look at how our gdbus internal library (uses
> > > > > > > libdbus) utilize it:
> > > > > > >
> > > > > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
> > > > > > >
> > > > > >
> > > > >
> > > > > --
> > > > > Pali Rohár
> > > > > [email protected]
> > > >
> > > >
> > > >
> > >
> > > --
> > > Pali Rohár
> > > [email protected]
> >
> >
> >
>

--
Pali Rohár
[email protected]

2019-10-19 08:01:48

by Pasi Kärkkäinen

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Thu, Oct 17, 2019 at 11:59:57AM +0200, Pali Roh?r wrote:
> > > >
> > > > So... what should applications expects and how they should implement
> > > > above decision?
> > >
> > > Actually the decision should be based on the presence of
> > > RegisterApplication method, if that exists then endpoint switching
> > > should be supported as well, so has nothing to do the
> > > GetManagedObjects API of the bluetoothd. That said RegisterApplication
> > > was not made experimental which kind makes 5.51 broken because it
> > > would appear that it endpoint objects would be exposed but when in
> > > fact there are not, anyway lets finally have the code to use this
> > > interface and then we can remove the experimental flag from
> > > MediaEndpoint.
> >
> > Ok, so can pulseaudio do following?
> >
> > Call RegisterApplication. If success then expects that codec switching
> > is possible and via GetManagedObjects exports all available codecs.
> > If RegisterApplication fails then fallback to RegisterEndpoint, expects
> > that codec switching is not possible and so register only one SBC codec.
>
> Also can we solve this problem in bluez ASAP? Last released bluez
> version is due to that non-experimental API broken and once applications
> (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd
> -E would be broken.
>
> I would propose to remove experimental mark for codec switching API and
> release a new bugfix version of bluez, so people would not use released
> 5.51 broken version... which could prevent breakage of A2DP in future.
>

+1

It would be nice to get bluez 5.52 released before 5.51 gets released by distros..


-- Pasi

2019-10-19 08:14:48

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

Hi,

On Fri, Oct 18, 2019 at 1:32 PM Pasi Kärkkäinen <[email protected]> wrote:
>
> On Thu, Oct 17, 2019 at 11:59:57AM +0200, Pali Rohár wrote:
> > > > >
> > > > > So... what should applications expects and how they should implement
> > > > > above decision?
> > > >
> > > > Actually the decision should be based on the presence of
> > > > RegisterApplication method, if that exists then endpoint switching
> > > > should be supported as well, so has nothing to do the
> > > > GetManagedObjects API of the bluetoothd. That said RegisterApplication
> > > > was not made experimental which kind makes 5.51 broken because it
> > > > would appear that it endpoint objects would be exposed but when in
> > > > fact there are not, anyway lets finally have the code to use this
> > > > interface and then we can remove the experimental flag from
> > > > MediaEndpoint.
> > >
> > > Ok, so can pulseaudio do following?
> > >
> > > Call RegisterApplication. If success then expects that codec switching
> > > is possible and via GetManagedObjects exports all available codecs.
> > > If RegisterApplication fails then fallback to RegisterEndpoint, expects
> > > that codec switching is not possible and so register only one SBC codec.
> >
> > Also can we solve this problem in bluez ASAP? Last released bluez
> > version is due to that non-experimental API broken and once applications
> > (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd
> > -E would be broken.
> >
> > I would propose to remove experimental mark for codec switching API and
> > release a new bugfix version of bluez, so people would not use released
> > 5.51 broken version... which could prevent breakage of A2DP in future.
> >
>
> +1
>
> It would be nice to get bluez 5.52 released before 5.51 gets released by distros..

Just sent a patch marking these APIs as stable, when are we expecting
a new PA release btw?
--
Luiz Augusto von Dentz

2019-10-19 08:17:50

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Friday 18 October 2019 13:55:10 Luiz Augusto von Dentz wrote:
> Hi,
>
> On Fri, Oct 18, 2019 at 1:32 PM Pasi Kärkkäinen <[email protected]> wrote:
> >
> > On Thu, Oct 17, 2019 at 11:59:57AM +0200, Pali Rohár wrote:
> > > > > >
> > > > > > So... what should applications expects and how they should implement
> > > > > > above decision?
> > > > >
> > > > > Actually the decision should be based on the presence of
> > > > > RegisterApplication method, if that exists then endpoint switching
> > > > > should be supported as well, so has nothing to do the
> > > > > GetManagedObjects API of the bluetoothd. That said RegisterApplication
> > > > > was not made experimental which kind makes 5.51 broken because it
> > > > > would appear that it endpoint objects would be exposed but when in
> > > > > fact there are not, anyway lets finally have the code to use this
> > > > > interface and then we can remove the experimental flag from
> > > > > MediaEndpoint.
> > > >
> > > > Ok, so can pulseaudio do following?
> > > >
> > > > Call RegisterApplication. If success then expects that codec switching
> > > > is possible and via GetManagedObjects exports all available codecs.
> > > > If RegisterApplication fails then fallback to RegisterEndpoint, expects
> > > > that codec switching is not possible and so register only one SBC codec.
> > >
> > > Also can we solve this problem in bluez ASAP? Last released bluez
> > > version is due to that non-experimental API broken and once applications
> > > (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd
> > > -E would be broken.
> > >
> > > I would propose to remove experimental mark for codec switching API and
> > > release a new bugfix version of bluez, so people would not use released
> > > 5.51 broken version... which could prevent breakage of A2DP in future.
> > >
> >
> > +1
> >
> > It would be nice to get bluez 5.52 released before 5.51 gets released by distros..
>
> Just sent a patch marking these APIs as stable

Great! Thank you!

Now there is only my question about undocumented DelayReporting. Can you
look at that email?

> when are we expecting a new PA release btw?

I do not know. I even do not know if release date was announced.

--
Pali Rohár
[email protected]

2019-11-14 11:28:58

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method

On Wednesday 09 October 2019 15:20:40 Pali Rohár wrote:
> On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > Hi Pali,
> > >
> > > It is just another D-Bus method, the only difference is that it
> > > carries the entire object tree, btw I did add an example of how to
> > > register Endpoints in python:
> > >
> > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> >
> > This example uses undocumented property "DelayReporting". What it is doing?
>
> And I would like to know what is that undocumented DelayReporting is
> doing? And to which value should I initialize it in pulseaudio?

Luiz, any comments on this?

--
Pali Rohár
[email protected]

2020-04-15 14:28:46

by Pali Rohár

[permalink] [raw]
Subject: Undocumented property "DelayReporting" (Was: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method)

On Thursday 14 November 2019 12:27:53 Pali Rohár wrote:
> On Wednesday 09 October 2019 15:20:40 Pali Rohár wrote:
> > On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
> > > On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
> > > > Hi Pali,
> > > >
> > > > It is just another D-Bus method, the only difference is that it
> > > > carries the entire object tree, btw I did add an example of how to
> > > > register Endpoints in python:
> > > >
> > > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
> > >
> > > This example uses undocumented property "DelayReporting". What it is doing?
> >
> > And I would like to know what is that undocumented DelayReporting is
> > doing? And to which value should I initialize it in pulseaudio?
>
> Luiz, any comments on this?

Luiz, could you please tell me some information about this undocumented
property to which value should I set it? I really need it for proper
implementation of endpoints in pulseaudio.

I was not able to decode its meaning from source code nor found any
other information about it.