[Kde-hardware-devel] [GSoC] Project: Make Libbluedevil Async

David Rosca nowrep at gmail.com
Fri Mar 14 16:08:45 UTC 2014


Hi all,
I'm sending you a first version of my proposal.

Àlex, and possibly others, can you please take a look at it?

Thanks in advance,
David Rosca

-------------------------------------------------------------------

Name: David Rosca

Email Address: nowrep at gmail.com

Freenode IRC Nick: nowrep

IM Service and Username: xmpp: nowrep at jabbim.cz

Location (City, Country and/or Time Zone): Prague, Czech Republic

Proposal Title: Make libbluedevil async

Mentor: Àlex Fiestas <afiestas at kde.org>

Motivation for Proposal / Goal:

Libbluedevil is a Qt library for accessing BlueZ. It internally uses
D-Bus, which
is asynchronous. However, most of the current libbluedevil API is synchronous,
that means it blocks application until receiving reply.

The goal of this project is to introduce a new asynchronous QBluez
library (libqbluez)
and to port all parts of Bluedevil from libbluedevil to the new QBluez library.
QBluez will offer same functionality as libbluedevil using asynchronous API.

During the GSoC season, I would like to deliver:
 * asynchronous QBluez library offering same functionality as libbluedevil
 * documentation for the QBluez library
 * all Bluedevil components ported from libbluedevil to QBluez


Implementation Details:

The QBluez library will be pure Qt5 library using only QtCore and
QtDBus modules.
Given the fact the new library will be asynchronous, the API will
differ from libbluedevil.
However, I will try to use the same API wherever it is possible and makes sense.

Basically, the API will mostly change in how Device and Adapter
objects are obtained.
This is an example code how to get usable adapter with new API:


        QBluez::FetchAdapterJob *job = QBluez::Manager::self()->usableAdapter();

        connect(job, &QBluez::FetchAdapterJob::finished, [=](bool ok) {
            // Adapter object has now all properties populated and is
ready to use
            if (ok)
                QBluez::Adapter *adapter = job->adapter();
            else
                qWarning() << "Error" << job->error();

            job->deleteLater();
        });

        // Start the job asynchronously
        job->start();

There will also be a way to execute the job synchronously:

        QBluez::FetchAdapterJob *job = QBluez::Manager::self()->usableAdapter();

        // Blocks until finishing job
        bool ok = job->exec();

        if (ok)
            QBluez::Adapter *adapter = job->adapter();
        else
            qWarning() << "Error" << job->error();

        job->deleteLater();


The Device and Adapter classes also have methods that modify the
object (eg. setTrusted, ..). The result of these actions will be reported
asynchronously with related xxxChanged signals (eg. trustedChanged(bool)).

Provided this is Qt5 library, it will be possible to use some C++11 features.
Lambda expressions are very convenient for asynchronous code, as seen in the
example code provided above.

Qt provides asynchronous way of calling D-Bus methods with QDBusPendingCall and
QDBusPendingCallWatcher. In my opinion there is no need to run jobs in
separate thread.

If i get some spare time, I would also like to extend QBluez with API
for OBEX services.


Tentative Timeline:

to May 19:
Community-bonding part, setting up the environment, ...

May 19 - June 23:
Start coding. Create first version of library and discuss its API.

June 23 - June 27 (Mid-term evaluation):
By this time the library should be in a good shape. Start porting
Bluedevil to QBluez.

June 27 - August 4:
Bluedevil should now be ported to QBluez. Start investigating new API for OBEX.

August 4 - August 11:
Make sure everything works correctly. Start working on documentation.

August 11 - August 18 (Pencils down):
Finish the documentation.

After GSoC:
I would like to finish OBEX API and use it in remaining components of Bluedevil.


Do you have other obligations from late May to early August?

I have a school and exams in May and July. So I won't be able to work
on the project
full-time in this period of time.
After the exams, there is no problem in my full participation and I
can work during
the weekends too.


About Me:

This is my second application for GSoC. I participated in GSoC last
year under KDE
and it was a great experience for me.
I am a second year student at Czech Technical University - Faculty of
Informatics.
I have experience with Qt/C++ from my projects, QupZilla QtWebKit browser being
the biggest one.

I have been a KDE user for quite some time now. I submitted few small patches
to KDE projects, but mostly it was only to fix little things that annoyed me.
By participating in this GSoC, I would like to finally make a bigger
contribution
to KDE.

GitHub profile: https://github.com/nowrep


Junior job link:

https://bugs.kde.org/show_bug.cgi?id=327412


More information about the Kde-hardware-devel mailing list