Hi,

The DBus system is now (almost) fully supported in Gambas 3, by the gb.dbus 
component.

What is DBus ? It is a "message bus system", i.e. a little program that can 
pass different kinds of messages between applications. It's like the old KDE 3 
DCOP system. For more information, see http://dbus.freedesktop.org.

There are normally two kind of bus running on your machine: the "system bus", 
that is global and unique, and the "session bus", that is launched for each 
connected user.

gb.dbus allows you to:

(1) Call any method or property exported by any application that is connected 
with the bus.

Example: 

        DBus["org.kde.kmail"]["/kmail/kmail_mainwindow_1"].geometry = 
                [0, 24, 1024, 768]

The syntax is:

- DBus[<Application>][<Object path>].<Method>(<Arguments>)
- DBus[<Application>][<Object path>].<Property>

<Application> can begin with "system://" or "session://" to define which bus 
you want to connect with. By default you connect with the session bus.

(2) Catch any signal raised by any interface.

Example:

        MySignal = New DBusSignal(DBus.System, "org.freedesktop.Hal.Manager",
                "DeviceAdded") As "DBusSignal"
        ...
        Public Sub DBusSignal_Signal(Signal As String, Arguments As Variant[])
          ...
        End

(3) Export any Gambas object to DBus, provided that the object inherits 
DBusObject.

Example:

        Dim hObject As MyClass ' MyClass inherits DBusObject

        DBus.Register(hObject, "/object/path")

The Gambas object is attached to an "object path", because all objects exposed 
to the DBus by your application is like a hierarchical file system.

What is exported?

- Public methods whose name has no underscore inside, and whose arguments and 
return type can be converted to a DBus datatype.

- Public properties whose name has no underscore inside, and whose type can be 
converted to a DBus datatype.

As soon as you register at least one object, your application appears on the 
bus with the name "org.gambas.<application name>".

All these methods and properties are exported with an interface name named 
"org.gambas.<application name>.<class name>".

You can test that with the DBus explorer example, or the qdbusviewer Qt4 
program.

What is not done yet ?

- You cannot raise DBus signals yet.

- You cannot use Collections yet.

Note that the gb.dbus component has a part written in C and a part written in 
Gambas. The part written in C provide hidden classes (whose name begins with 
"_") that the part written in Gambas uses to provided the full (and easy!) 
component interface.

Now just play with it and tell me what you think!

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to