Add MediaTransport API
ClosedPublic

Authored by mweichselbaumer on Jun 26 2019, 6:59 PM.

Diff Detail

Repository
R269 BluezQt
Branch
mediatransport
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13328
Build 13346: arc lint + arc unit
Restricted Application added a project: Frameworks. · View Herald TranscriptJun 26 2019, 6:59 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mweichselbaumer requested review of this revision.Jun 26 2019, 6:59 PM
drosca requested changes to this revision.Jun 27 2019, 5:45 AM
drosca added inline comments.
src/a2dp-codecs.h
33

Are you sure about this?

src/mediatransport.h
47

quint16

src/tpendingcall.h
45

Is this really needed? In the end, it doesn't really make the code that much better:

TPendingCall<QDBusUnixFileDescriptor, uint16_t, uint16_t> *fd = transport->tryAcquire();
fd->valueAt<0>();
fd->valueAt<1>();
fd->valueAt<2>();

vs

PendingCall *fd = transport->tryAcquire();
fd->values().at(0).value<QDBusUnixFileDescriptor>();
fd->values().at(1).value<uint16_t>();
fd->values().at(2).value<uint16_t>();

Or we can add convenience method T valueAt(int) so it becomes:

PendingCall *fd = transport->tryAcquire();
fd->valueAt<QDBusUnixFileDescriptor>(0);
fd->valueAt<uint16_t>(1);
fd->valueAt<uint16_t>(2);
This revision now requires changes to proceed.Jun 27 2019, 5:45 AM
mweichselbaumer marked an inline comment as done.Jun 27 2019, 7:24 AM
mweichselbaumer added inline comments.
src/a2dp-codecs.h
33

Yes, this has also been fixed by bluez as of 2018-12-28.

src/tpendingcall.h
45

Actually, my intention was to provide a type-safe way to obtain return values from PendingCall and to express explicitly, what the corresponding method returns in API header.
As a client you can make use of "auto".

Consider:

auto *fd = transport->tryAcquire(); // Method declaration will define return type.
auto ret1 = fd->valueAt<0>();
auto ret2 = fd->valueAt<1>();
auto ret3 = fd->valueAt<2>();

Thus, return type (of PendingCall) is expressed in API header and clients do not need to express the return types themselves.

ltoscano added inline comments.
src/a2dp-codecs.h
33

Will it work with older versions of bluez?

src/a2dp-codecs.h
33

Bluez just defines this constant, but does not use it internally (nor we do).
So, yes, this works with any version of bluez.

drosca accepted this revision.Jun 28 2019, 8:29 AM
drosca added inline comments.
src/tpendingcall.h
45

Alright, that makes sense.

With KF6 we can convert all PendingCalls to this form. It would be a good idea to add TODO: KF6 somewhere to not forget it.

This revision is now accepted and ready to land.Jun 28 2019, 8:29 AM
src/tpendingcall.h
45

Ok, i will update this patch and land it in a couple of days.