I've asked a few questions on this list over the last week, or two, and
got little or no response, so maybe this ain't as active as the IRC
Channel, where I got some great help from cp15. I think I'm going to
need a bit of typing for the questions I have to ask so I'll stick to
email for this one.
The Navit DBus signals which are emitted from the application have to be
"turned on" before they will get emitted by navit. The wiki page on DBus
gives the method to do this from the command line. First the command:
dbus-send --print-reply --session --dest=org.navit_project.navit
/org/navit_project/navit org.navit_project.navit.callback_attr_new
string:my_signal string:bookmark_map
is issued, which is all one line. This call to dbus-send will result in
an object path being returned:
object path "/org/navit_project/navit/callback/0"
and then that path is used in the second call to dbus-send:
dbus-send --print-reply --session --dest=org.navit_project.navit
/org/navit_project/navit/default_navit
org.navit_project.navit.navit.add_attr string:callback
variant:objpath:/org/navit_project/navit/callback/0
Again that's all one line, and the last argument is the return from the
first dbus-send call.
The above is all well and good but to do this from a Python program the
first call to dbus-send is more or less:
import dbus
bus = dbus.SessionBus()
object =
bus.get_object("org.navit_project.navit","/org/navit_project/navit")
iface = dbus.Interface(object, dbus_interface='org.navit_project.navit')
iter=iface.attr_iter()
path = object.get_attr_wi("navit",iter)
navit=bus.get_object('org.navit_project.navit', path[1])
iface.attr_iter_destroy(iter)
result = navit.callback_attr_new("my_signal", "bookmark_map")
That's the result of the first call and all that looks good if I print
the result. Moving on to the second command line call to dbus-send, I
first need another interface
iface = dbus.Interface(object,
dbus_interface='org.navit_project.navit.navit')
iter=iface.attr_iter()
path = object.get_attr_wi("navit",iter)
navit2=bus.get_object('org.navit_project.navit', path[1])
iface.attr_iter_destroy(iter)
navit2.draw()
navit2.add_attr("callback", result);
In the above I called the navit2.draw() method just to confirm that in
python I could call something and the draw() method is executed
correctly but the add_attr() method will not get called because of my
parameters. I've looked in bindings_dbus.c and add_attr() is expecting
"sv" a string and a value. I've been looking of DBus specs but can't
really see a value type. Has anybody used this method from Python and if
so how.
I'm not sure this would ever work in Java DBus ;-)
Thanks a million for any help anybody can offer.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Navit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/navit-users