Describe Vala/DBus here. This is some ideas.
Introduction
Full flexible DBus supporting is important for vala:
- vala aims to be the development language of gnome.
- gnome is utilizing dbus in the future.
Inherited Members
Inherieted members are also member of current class. Thus they should be treated equally.
- signals
- being able to put signals inherited from base class on the bus.
- methods
- ordinary method
- overriding an ordinary method
- overriding an virtual method
- a special case, because vala only generate a vtable-function but not a seperate member function to invoke it; we need to use the base class member function, which will forward the request to the proper real vtable-function.
- properties
- being able to put properties inherited from base class on the bus.
Visibility Issue
- not every public member shall be exposed on the bus
- extend [DBus ] directive to support selectively exposing members;
- [DBus signals = "signal list"]
- [DBus properties = " prop list"]
- [DBus methods = "method list"]
- not clearly showing which is inherited which is not.
- can not use [DBusMember] or similiar per member directive, because of the inherited members are not shown here.
- Does it make sense to expose private member on the bus?
- possibly, because public/private intends to restrict the access from objects with-in the process; whereas exposing an object on DBus is a different story.
Task Tracking
Things to be done:
- signals, from the base class and from the class
- properties, from the base class and from the class
- overriden methods
- void return value
- string[] return value
- Transparent object access, if fails, use 7
- lookup registered object from a connection.
So far has been done at svn://gnome2-globalmenu.googlecode.com/svn/branches/0.6-devel/vala/ (in the patch files)
done, [DBus (signals = "sig1, sig2")]; Bug 531132
intrepolation is done, [DBus (properties = "p1, p2")] but no dynamic object supporting yet; Bug 531132;
- done, using the parent class method cname; Bug 531132 and Bug 531135;
- not done; don't know why it fails.
- string[] return value; finished in Bug 530455 and Bug 531251, also Bug 529351.
- not easy to done(DBus returns a DBusGObjectPath, which is a string) and not seeming to be reliable.
done in dbus-glib-1.vapi (weak Object DBus.Connection::lookup_object(string path)); Bug 531131
Use Case
Then it follows a piece of example code, which is excepted to work after all are done:
Server side code:
class Funk : Object { public void signal funky(); public virtual void funk() { funky(); } } [DBus (name = "org.gnome.TestServer", signals = "funky, echo", properties = "name, mess")] class TestServer: Funk { public string name {get; construct;} public string mess {get; set;} public TestServer(string name) { this.name = name; } construct { mess = name; } public void signal echo(string msg); public override void funk() { base.funk(); } public string ping(string msg) { message(msg); echo(mess); } public void main(string[] args){ MainLoop loop = new MainLoop(..); .... Setup dbus connection.... TestServer server = new TestServer("funky server"); conn.register_object("/org/gnome/TestServer", server); loop.run(); } }
Client side code
public void main(string[] args { ... Setup dbus connection... var server = conn.get_object(..., "/org/gnome/TestServer", ......); server.echo += (o, s) => { message(s); }; server.funky += (o) => { message("funky signal received"); }; server.ping("pingping ping"); server.mess = "messy echo"; server.ping("ping a mess"); }