Tuesday, May 18, 2010

GSoC: Discovering Solids

Hello, all. It's been a while since my last post, but here I am to update you about my progress with my Google Summer of Code project (explained here).

Well, this community bonding period aims to get students aware of technologies involved on the projects, documentation and, of course, the code. Since I'm pretty new with Solid, Kevin told me that a Techbase page explaining the libsolid architecture would be a good exercise of my current understanding about the project. So, the document is ready and the Techbase page will be up as soon as I discover how to create one. :-D

Besides that I've decided to put it here too, for the posterity and, of course, for any feedback you can give me. Any comments would be really appreciated. It's really simple and small, as you can see right below.

Cheers.

--

Solid (kdelibs/solid)

The KDE 4 provides seamless hardware integration through Solid framework. Using its API, developers become able to easily write applications with hardware interaction features, through a hardware discovery layer which allows the detection and use of devices regardless of operating system or architecture.

Solid was implemented using a frontend/backend approach aiming portability among platforms like Linux and Windows. The frontend provides the high-level API for developers using Solid and backends deal with the specific hardware issues for the different platforms.

Frontend View

The frontend classes provide the API for developers and are also wrappers for several kinds of devices. All frontend clases are available in kdelibs/solid/solid.

  • Solid::DeviceNotifier
The device notifier is a singleton used to obtain information about the hardware available on the system. It provides to applications the unique entry point for hardware discovery and/or notifications about changes (with the use of Solid::DeviceNotifier::deviceAdded and Solid::DeviceNotifier::deviceRemoved signals). This class calls the following Solid::DeviceManager.
  • Solid::DeviceManager

This (private) class maintains the state of all devices currently available on the system. Through it is possible to get, for example, the list of all devices or a list of device matching with some criteria (using Solid::Predicate).

  • Solid::Device

This class represents a general hardware device. A device contains one or more device interfaces (capabilities).

  • Solid::DeviceInterface

A device interface represents a certain feature that a device contains. This class is on the top of the device interfaces inheritance tree. All specialized device interfaces implement it.

  • Specialized classes (Solid::Processor, Solid::OpticalDrive, Solid::Battery, etc.)

These classes actually represent the capabilities that a device can have. All classes extend Solid::DeviceInterface.

Backend View

A Solid backend deal with the platform-specific ways of handle devices. Developers using libsolid do not use the backend classes directly. Applications do it through frontend/wrapping classes in the Solid namespace.

All backends have to implement the interfaces in kdelibs/solid/solid/ifaces (namespace Solid::Ifaces) correspondent to its devices. These interfaces are the basics of which API a given device has to provide to the frontend classes.

UML Diagram

This diagram shows the relationships between the Solid frontend classes and the platform-specific backend classes (Foo backend example).

2 comments:

  1. I have never ever had a look at solid (and am no learned programmer), but I've got the impression that this is a very good technical overview over the solid architecture in this article. I like it, especially the frontend part.

    The backend part could be a bit more extensive and the separation between Solid:DeviceInterface (respectively Solid:Processor etc.) and their respective interfaces (Solid:Ifaces:*) could be a bit clearer to point out that the interfaces are actually the intermediate layer.

    Maybe it would make sense to put the explanation that backends implement the interfaces first. Then, I'd say that the backends are used via these interfaces by the Solid:DeviceManager etc. which are finally used by the desktop apps. This would be a structure from bottom to top, which I find helps to understand because one stratum is built on the next higher stratum. Currently, its the other way round.

    Some language issues, too. But hey, you're studying Computer Science and not English literature. If you want, I'll revise it for you.

    ReplyDelete
  2. Hello, flow, and thanks for the feedback! =)

    I agree with you and I'll try to improve the backend part. And I would really like your revision (I'm brazilian and my english is pretty ad-hoc :p).

    How can I send it to you?

    ReplyDelete