March 25, 2007

GSoC 2007 Proposal

Bluetooth support on KDE4



Abstract

Today, most people (at developed countries) carries some Bluetooth capable cell phone or, looking at the current supply at shops, they will very soon. Bluetooth is a wonderful technology that joins power efficiency with easiness, making things like file sharing, wireless hands free and so a child's game. Of course, Bluetooth is not an exclusive property of the handheld world, and it's easy to find USB Bluetooth devices in the 15€/10$ range, and many new computers include it by default.

Like any other wireless technology, or network technology for the matter, when using Bluetooth each device has a world-single "name" called Bluetooth Device Address (BD_ADDR), see MAC on Ethernet, which is a 48 bit number that is unique for each Bluetooth capable device and is used by each device to communicate with others. In addition, each device has a user editable Name with the only objective of making users life easier (people don't work very well with 48bit numbers), so you will never find two Bluetooth device with the same BD_ADDR, but you can find an undetermined number of devices with the same Name.

In addition, Bluetooth management has been developed in the Linux world for some years, now we have the BlueZ stack integrated in 2.4 and 2.6 kernels providing a library to manipulate Bluetooth devices and a D-Bus interface with the same purpose. Also, KDE has gone it's way and has the KDEBluetooth project, which provides a DCOP interface to the underlying BlueZ DBus interfaces, but has one little issue, is not KDE4 ready. The first part of this proposal is to solve that problem.

All this plots an scenario where a user arrival/leaving can be easily identified from Linux using few different ways. What if your computer pauses the music you are listening on Amarok, locks the screen and mutes the audio when you leave, and also unlock the screen, restart playing your music and opens your favorite mail program and a browser with your favorite tabs when you get back to range. This is a feature that has already been included in OSX through the Proximity application, or even on Linux with the command line tool bluemon, so this proposal includes creating a similar application called Bluetooth Presence Manager, BtPM, using KDE4, on top of the previous Bluetooth support works.

Bluetooth for KDE4

Actually, KDEBluetooth uses the library interface to BlueZ, and there is a version on the KDE svn that uses the D-Bus one. Both versions work well, but they both suffer of an identical defect, they are Linux-exclusive as BlueZ only exists on that platform. Betwen a new HAL module for KDE, called Solid, is under development.

That Solid layer works like any other HAL and provides interfaces to "kinds" of devices that are then mapped on a concrete back end implementation depending on the host operating system, and that can be accessed on a programmatic way from kdelibs. This way, a KDE application gets more independence of the hardware it's running on, with all the benefits deriving from it (from a multiplatform perspective).

Work has been already started by Daniel Gollub to create a Bluetooth interface on Solid and he is working to get it included on KDE 4.0. So, the first thing I propose is to help making it possible.

Once we have a stable version of the Solid interface, then I'll write a new version of KDEBluetooth on top of it. After some discussion on IRC we've decided that it's a better idea to rebuild it from scratch as a lot of code to deal with BlueZ will disappear (and it's a lot of KDEBluetooth) and also the changes in Qt and KDE make it not a very appealing task to port the old one as it's written with a some constraints that will disappear after the Solid interface is done.

I've done a little research that's represented on the following table and graph to help me planning this work, it's just a count of how many lines does each KDEBluetooth module has and a time prediction based on that (not the best metric though, but enough to get an idea):


Bluetooth Presence Manager


The idea for BtPM is to create a more visually appealing interface than what Proximity/Bluemon provides, that can handle multiple local/remote devices and provides some predefined actions to associate with the arrival/leave events, for example:

  • Start/Stop Amarok playback, with a given playlist/folder.
  • Lock/Unlock the screen.
  • Set/Unset kopete/konversation away state.
  • Run an arbitrary command (or a command from the KMenu)
  • ...

There are plenty more actions somebody can imagine, and as most KDE applications provide DCOP interfaces adding them once the infrastructure is developed would be trivial. My idea for this application is to be mostly visual,from menu you open a frame to select local device, then in a sub window of the main frame you get icons representing remote devices laid on a grid. In another sub-window there are icons for all the available actions, so when the user wants to associate an action with a device, he justs drags the desired action over that device and a window pops asking with which event wants the action to be associated with and asking for any parameters the action may need. Of course, interface will also allow to examine which actions are associated with a given device, and modify/delete them, as well as exploring disconnected devices that have some action associated (probably a "Show Hidden" option on contextual menu).

Deliverables

Based on the previous description there are three main deliverables associated with this proposal:
  • Add Bluetooth to the Solid library: There is a lot of work done on this by Daniel, but I'll help him with the frontend and any other stuff that comes along.
  • A rewrite of KDEBluetooth using the previous Solid interface and KDE 4. This must provide the same functionalities the KDE 3 version does.
  • Bluetooth Presence Manager (BtPM) for KDE4, this will be included as a KDEBluetooh module and will make use of the named Solid interface. This should include a user manual, but i'll keep it on DESIRED.

Timeline

According to the official program time line, coding should start on May 28 and end at August 20 (12 weeks), but as feature freeze for KDE 4.0 is April 1, I will start working with Daniel before May 28 so the Solid part is (hopefully) available for 4.0. As this work will be out of the official time frame and also there is a lot of it already done I won't include it in the schedule for the official period, and I'll count it as a training with KDE4 development. For the another two deliverables here is a Gantt chart showing what I expect based on the data shown before.

Technologies

The involved software components have already been mentioned, but here is a summary:
  • Kubuntu 6.10, this is the distribution I use, and the one where every development will occur.
  • KDE 4, using the head SVN version during all the project, and keeping it in sync with any possible api change. Solid is part of KDE 4.
  • BlueZ, the DBus interface to which KDEBluetooth binds.
  • KDEBluetooth, this is one of the core parts of this proposal, rewrite KDEBluetooth for KDE4.
  • All the KDE toolchain(KDevelop, KBabel, cmake, ...)

About the hardware used:
  • I have a a USB Bluetooth adapter from Conceptronic that works perfectly on my Kubuntu system.
  • My mobile phone has bluetooth support and is correctly detected by Bluez.
  • Well, my computer, just standard.

About me

I'm a CS student in the last undergrad year at an University in southern Spain (so I'm spaniard). Last two years I participated on SoC with the Project Looking Glass, (succesfully) doing Java development which is my strongest actually. I have C++ knowledge, not as solid as it's for Java, but quite good (and getting better as I read/write code).

I installed Linux for the first time in 1997 (#90724), and I've been using it as my main OS since then (Slackware, Suse, Debian, Kubuntu (nicest for me)) and KDE since a bit later (say 2000), so I'm quite familiar with it (also with some BSD flavors, but less). I've also done some little developments for the university using the KDE libs, kdevelop+designer combined with the konqueror kde: shortcut makes life much easier than what gtk+glade used to last time I tried.

I'm familiar with CVS, and to less extend with SVN (enough to work with it). I also know Bash,HTML,PHP,... and many things I won't need for this project.



PS: I'm sure you already noted it, but English is not my mother tongue so, sorry for any mistake.

No comments:

Creative Commons License All this site has a Creative Commons License.