Fun With Vala and DBus
‘Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.’
DBus is a low latency IPC system with less overhead with emphasis on desktop applications
I must say the folks at #vala in GimpNet has been patient with me, especially considering the silly questions I had been asking for the last couple of days. I should get commit access to the git repositories of freesmartphone.org in a short while as well :D.
I learned a couple of things on the way. Especially the KeyFile API from the GLib library really rocked. Note that odeviced would have configuration file sitting in ‘/etc’ containing various settings like plugins to be loaded, their own internal switches and so on. I would have almost “reinvented the wheel” trying to reimplement stuff thats already provided by GLib if I hadn’t browsed through the API reference of GLib. Implementing something like the above for odeviced in vala looks something like this,
1 2 3 4 5 6 7 8 9 10 11 12
Of course, the corresponding configuration file will look something like this,
1 2 3 4 5
In the above example, things within ‘[’ and ‘]’ are group names and each of these groups consist of a key-value pair.
As for the dbus part, each plugin would set up dbus objects on their own. GModule library will be used to load the .so libraries. So we’d have object paths like
/org/freesmartphone/Device/powercontroller. And of course, odeviced will be on the System Bus.
On a related note, the “surprise” gift is on its way :D.