Difference between revisions of "Development/Architecture/KDE4/Solid"

Jump to: navigation, search
(spelling)
(Marked this version for translation)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Seamless Hardware Interaction ==
+
<languages />
 +
 
 +
== <translate><!--T:1-->
 +
Seamless Hardware Interaction</translate> ==
 +
<translate><!--T:2-->
 
With Solid, KDE developers are able to easily write applications with hardware interaction features. The necessary abstraction to support
 
With Solid, KDE developers are able to easily write applications with hardware interaction features. The necessary abstraction to support
cross-platform application development is provided by Solid's clear and comprehensive API.
+
cross-platform application development is provided by Solid's clear and comprehensive API.</translate>
  
Its aim is not the control of the devices (Solid doesn't let you syncronize your mobile phone with your local addressbook): Solid *looks for* devices and gives you access to the information it has about them. This way, you could easily look at the functions of the cpu, or at the driver that handles your camera, or the mount point of your usb pen. In sum: it gives you the possibility of "seeing without touching" your devices.
+
<translate><!--T:3-->
 +
Its aim is not the control of the devices (Solid doesn't let you synchronize your mobile phone with your local address book): Solid ''looks for'' devices and gives you access to the information it has about them. This way, you could easily look at the functions of the cpu, or at the driver that handles your camera, or the mount point of your usb pen. In sum: it gives you the possibility of "seeing without touching" your devices.</translate>
  
Now you would ask (at least, I asked myself): "Why should I need this library? I want to control the available hardware, not just see it!"
+
<translate><!--T:4-->
 +
Now you would ask (at least, I asked myself): "Why should I need this library? I want to control the available hardware, not just see it!"</translate>
  
 +
<translate><!--T:5-->
 
Well, Solid helps you a lot again: for any device interface, it gives you enough information to easily access it using other libraries or stacks. This way, if you want to manage your camera, you can use Solid to recognize it (you can use Solid::Notifier that will let you know when your camera has been plugged in), and then you can ask Solid to give you the information you need to handle it, for example with GPhoto or any other library you can think of. The same applies for any other plugged device: DVB cards (once recognized, Solid gives you the name of the associated device), audio cards (you can use ALSA, OSS or whatever you want: Solid knows the data to access it), portable media players, network cards, et cetera.
 
Well, Solid helps you a lot again: for any device interface, it gives you enough information to easily access it using other libraries or stacks. This way, if you want to manage your camera, you can use Solid to recognize it (you can use Solid::Notifier that will let you know when your camera has been plugged in), and then you can ask Solid to give you the information you need to handle it, for example with GPhoto or any other library you can think of. The same applies for any other plugged device: DVB cards (once recognized, Solid gives you the name of the associated device), audio cards (you can use ALSA, OSS or whatever you want: Solid knows the data to access it), portable media players, network cards, et cetera.
Moreover, it lets you check if you're connected to any network or not, and you can use Solid to tell the system to connect (that is, you can ask Solid: "Give me access to the network, I don't want to care about details").
+
Moreover, it lets you check if you're connected to any network or not, and you can use Solid to tell the system to connect (that is, you can ask Solid: "Give me access to the network, I don't want to care about details").</translate>
 +
 
 +
<translate><!--T:6-->
 +
Anyway, some other things need to be said about network devices and Bluetooth. For these two classes of devices, Solid provides the "Control" namespace: that is, it lets you control them directly, without using external libraries. This means that with Solid, you can even handle your wireless or wired network interfaces, associate them to an essid, and choose ip configuration for them. You can even access your phone through Bluetooth, and so on.</translate>
 +
 
 +
<translate><!--T:7-->
 +
The "listing" part of Solid resides in kdelibs, while the Control namespace is in kdebase.</translate>
 +
 
 +
== <translate><!--T:8-->
 +
Architecture Summary</translate> ==
 +
 
 +
<translate><!--T:9-->
 +
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.</translate>
 +
 
 +
=== <translate><!--T:10-->
 +
Frontend View</translate> ===
 +
 
 +
<translate><!--T:11-->
 +
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''.</translate>
 +
 
 +
==== Solid::DeviceNotifier ====
 +
<translate><!--T:12-->
 +
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(const QString) and Solid::DeviceNotifier::deviceRemoved(const QString) signals). This class calls the following Solid::DeviceManager.</translate>
 +
 
 +
==== Solid::DeviceManager ====
 +
 
 +
<translate><!--T:13-->
 +
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).</translate>
 +
 
 +
==== Solid::Device ====
 +
 
 +
<translate><!--T:14-->
 +
This class represents a general hardware device. A device contains one or more device interfaces (capabilities).</translate>
 +
 
 +
==== Solid::DeviceInterface ====
 +
 
 +
<translate><!--T:15-->
 +
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.</translate>
 +
 
 +
==== <translate><!--T:16-->
 +
Specialized classes (Solid::Processor, Solid::OpticalDrive, Solid::Battery, etc.)</translate> ====
 +
 
 +
<translate><!--T:17-->
 +
These classes actually represent the capabilities that a device can have. All classes extend Solid::DeviceInterface.</translate>
 +
 
 +
=== <translate><!--T:18-->
 +
Backend View</translate> ===
 +
 
 +
<translate><!--T:19-->
 +
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.</translate>
 +
 
 +
<translate><!--T:20-->
 +
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.</translate>
 +
 
 +
=== <translate><!--T:21-->
 +
UML Diagram</translate> ===
  
Anyway, some other things needs to be said about network devices and Bluetooth. For these two classes of devices, Solid provides the "Control" namespace: that is, it lets you control them directly, without using external libraries. This means that with Solid, you can even handle your wireless or wired network interfaces, associate them to an essid, and choose ip configuration for them. You can even access your phone through Bluetooth, and so on.
+
<translate><!--T:22-->
 +
This diagram shows the relationships between the Solid frontend classes and the platform-specific backend classes (''Foo'' backend).</translate>
  
The "listing" part of Solid resides in kdelibs, while the Control namespace is in kdebase.
+
[[File:Solid_Class_diagram.png|600px]]
  
[[Category:KDE4]]
+
<translate><!--T:23-->
[[Category:Architecture]]
+
[[Category:KDE4]]</translate>
[[Category:Solid]]
+
<translate><!--T:24-->
 +
[[Category:Architecture]]</translate>
 +
<translate><!--T:25-->
 +
[[Category:Solid]]</translate>

Latest revision as of 02:17, 4 January 2013

Other languages:English 100%

Contents

[edit] Seamless Hardware Interaction

With Solid, KDE developers are able to easily write applications with hardware interaction features. The necessary abstraction to support cross-platform application development is provided by Solid's clear and comprehensive API.

Its aim is not the control of the devices (Solid doesn't let you synchronize your mobile phone with your local address book): Solid looks for devices and gives you access to the information it has about them. This way, you could easily look at the functions of the cpu, or at the driver that handles your camera, or the mount point of your usb pen. In sum: it gives you the possibility of "seeing without touching" your devices.

Now you would ask (at least, I asked myself): "Why should I need this library? I want to control the available hardware, not just see it!"

Well, Solid helps you a lot again: for any device interface, it gives you enough information to easily access it using other libraries or stacks. This way, if you want to manage your camera, you can use Solid to recognize it (you can use Solid::Notifier that will let you know when your camera has been plugged in), and then you can ask Solid to give you the information you need to handle it, for example with GPhoto or any other library you can think of. The same applies for any other plugged device: DVB cards (once recognized, Solid gives you the name of the associated device), audio cards (you can use ALSA, OSS or whatever you want: Solid knows the data to access it), portable media players, network cards, et cetera. Moreover, it lets you check if you're connected to any network or not, and you can use Solid to tell the system to connect (that is, you can ask Solid: "Give me access to the network, I don't want to care about details").

Anyway, some other things need to be said about network devices and Bluetooth. For these two classes of devices, Solid provides the "Control" namespace: that is, it lets you control them directly, without using external libraries. This means that with Solid, you can even handle your wireless or wired network interfaces, associate them to an essid, and choose ip configuration for them. You can even access your phone through Bluetooth, and so on.

The "listing" part of Solid resides in kdelibs, while the Control namespace is in kdebase.

[edit] Architecture Summary

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.

[edit] 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.

[edit] 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(const QString) and Solid::DeviceNotifier::deviceRemoved(const QString) signals). This class calls the following Solid::DeviceManager.

[edit] 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).

[edit] Solid::Device

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

[edit] 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.

[edit] 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.

[edit] 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.

[edit] UML Diagram

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

Solid Class diagram.png


This page was last modified on 4 January 2013, at 02:17. This page has been accessed 16,737 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal