4.3.1. Dbus

The Navit dbus interface allows you to control certain aspects of Navit from outside the program. This document displays the requirements and implementation details of the Navit dbus interface.

4.3.2. Enabling

To be able to send and receive signals from Navit, you must enable it in navit.xml. Change line 13 to the following:

<plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libbinding_dbus.so" active="yes"/>

4.3.3. Common actions

4.3.3.1. Zoom in/out

Zoom to level 500:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.set_attr string:"zoom" variant:int32:500

Zoom in by factor of 2:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.zoom int32:2

Zoom out by factor of 2:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.zoom int32:-2

4.3.3.2. Set Position/Destination

Set position to longitude 24.0, latitude 65.0:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.set_position string:"geo: 24.0 65.0"

Set destination to longitude 24.0, latitude 65.0:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.set_destination string:"geo: 24.0 65.0" string:"comment"

4.3.3.3. Set map-view centre

Centre the map to longitude 24.0, latitude 65.0:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.set_center_by_string string:"geo: 24.0 65.0"

4.3.3.4. Change map layout

Change layout to “Car-dark”:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit org.navit_project.navit.navit.set_layout string:"Car-dark"

4.3.3.5. Change vehicle profile

Change profile to “bike”:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit/default_vehicle org.navit_project.navit.vehicle.set_attr string:"profilename" variant:string:"bike"

4.3.5. org.navit_project.navit.navit

DBUS Object Path: /org/navit_project/navit/navit/[]

The way navit use dbus is not really the usual way. If you want to control your navit instance (set_destination, zoom,…), you have first to do the following (examples are in python) : 1) get the navit general object

`` object = bus.get_object(“org.navit_project.navit”,”/org/navit_project/navit”)``

  1. get the interface of this object :

`` iface = dbus.Interface(object,dbus_interface=”org.navit_project.navit”)``

  1. get an iterator through navit instances :

`` iter=iface.attr_iter()``

  1. get the object path of the navit instance in your iterator :

`` path = object.get_attr_wi(“navit”,iter)``

  1. get the navit instance you are interested in :

`` navit=bus.get_object(‘org.navit_project.navit’, path[1])``

  1. destroy the iter :

`` iface.attr_iter_destroy(iter)``

The following methods have to be applied on the navit object.

4.3.5.1. Methods

Examples are shown for each command, and when using on the command line must be prefixed by:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit

When a coordinate is specified, the coordinate can be formatted like:

[Proj:]-0xX [-]0xX

where Proj can be mg or garmin. Default: mg. For example:

mg: 0x138a4a 0x5d773f

Or

[Proj:][D][D]Dmm.ss[S][S] N/S [D][D]DMM.ss[S][S]... E/W
[Proj:][-][D]D.d[d]... [-][D][D]D.d[d]

where Proj must be geo. For example:

geo: 24.0 65.0

4.3.5.1.1. draw

Path:

.navit

Arguments:

none

Return:

none

Description:

Forces a redraw of the current view of the map

Example:

org.navit_project.navit.navit.draw

4.3.5.1.2. add_message

Path:

.navit

Arguments:

string: “message”

Return:

none

Description:

FIXME Adds a message to the messages label

Example:

org.navit_project.navit.navit.add_message string:”My Message”

4.3.5.1.3. set_center_by_string

Path:

.navit

Arguments:

string: coordinates

Return:

none

Description:

Centres the map over the specified position.

Example:

org.navit_project.navit.navit.set_center_by_string string:”geo: 24.0 65.0”

4.3.5.1.4. set_center

Path:

.navit

Arguments:

integer: projection string: coordinates

Return:

none

Description:

Centres the map over the specified position.

Example:

org.navit_project.navit.navit.set_center int32:1 string:”geo: 24.0 65.0”

org.navit_project.navit.navit.set_center int32:1 int32:0x138a4a int32:0x5d773f

4.3.5.1.5. set_center_screen

Path:

.navit

Arguments:

integer: pixel_x integer: pixel_y

Return:

none

Description:

Centers the map to a specific position on the screen.

Example:

org.navit_project.navit.navit.set_center_screen
int32:200 int32:400

4.3.5.1.6. set_layout

Path:

.navit

Arguments:

string: layoutname

Return:

none

Description:

Changes the active map layout.

Example:

org.navit_

project.navit.navit.set_layout string:”car-dark”

4.3.5.1.7. zoom

Path:

.navit

Arguments:

integer: factor (integer: pixel_x integer: pixel_y)

Return:

none

Description:

Zooms into the map (positive factor) or out of the map (negative factor) by the factor specified. The factor must be integers greater than 1 (zoom in) or less than -1 (zoom out). Optionally, a screen position can be specified in pixel_x and pixel_y and the function will zoom into that particular position. In order to zoom to a specific zoom-level, use the `set_attr <#set_attr>`__ method.

Example:

org.navit_project.navit.navit.zoom int32:2
org.navit_project.navit.navit.zoom
int32:6 int32:200 int32:400

4.3.5.1.8. block

Path:

.navit

Arguments:

integer: mode

Return:

none

Description:

FIXME

Example:

org.navit_project.navit.navit.block int32:1

4.3.5.1.9. set_position

Path:

.navit

Arguments:

string: coordinates
integer: projection string: coordinates
integer: projection integer: longitude integer: latitude

Return:

none

Description:

Sets the current position (useful if no gps position is available).

Example:

org.navit_project.

navit.navit.set_position string:”geo: 24.0 65.0”

org.navit_project.navit.na

vit.set_position int32:1 string:”geo: 24.0 65.0”

org.navit_project.navit.navit.se

t_position int32:1 int32:0x138a4a int32:0x5d773f

4.3.5.1.10. set_destination

Path:

.navit

Arguments:

string: coordinates string:”comment”
integer: projection string: coordinates string:”comment”
integer: projection integer: longitude integer: latitude string:”comment”

Return:

none

Description:

Sets the destination for routing.

Example:

org.navit_project.nav

it.navit.set_destination string:”geo: 24.0 65.0”

org.navit_project.navit.navit

.set_destination int32:1 string:”geo: 24.0 65.0”

org.navit_project.navit.navit.set_d

estination int32:1 int32:0x138a4a int32:0x5d773f

4.3.5.1.11. clear_destination

Path:

.navit

Arguments:

none

Return:

none

Description:

Removes the destination and stops routing.

Example:

org.navit_project.navit.navit.clear_destination

4.3.5.1.12. get_attr

Path:

.navit

Arguments:

string:attribute

Return:

string:attribute variant:value

Description:

Gets the specified attribute value. The attribute can be anything from attr_def.h.

Example:

org.

navit_project.navit.navit.get_attr string:”zoom”

returns:

string "zoom"
variant       int32 10

org.navit_p

roject.navit.navit.get_attr string:”orientation”

returns:

string "orientation"
variant       int32 1

4.3.5.1.13. set_attr

Path:

.navit

Arguments:

string:attribute variant:value

Return:

none

Description:

Sets the specified attribute value. The attribute can be anything from attr_def.h. As shown in the example below, this can be useful to zoom to a specific zoom level, insted of just zooming by a factor as with the `zoom <#zoom>`__ method.

Example:

org.navit_project.navi

t.navit.set_attr string:”zoom” variant:int32:500

4.3.5.1.14. export_as_gpx

Path:

.navit

Arguments:

string:filename

Return:

none

Description:

Dump the current route, if any, into the file specified in the argument in the GPX format.

Example:

org.navit_project.n

avit.navit.export_as_gpx string:”/tmp/route.gpx”

4.3.6. org.navit_project.navit.vehicleprofile

4.3.6.1. Methods

Examples are shown for each command, and when using on the command line must be prefixed by:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit/default_vehicleprofile

4.3.6.1.1. get_attr

Path:

.vehicleprofile

Arguments:

string:attribute

Return:

string:attribute variant:value

Description:

Gets the specified attribute value for the vehicleprofile.

Example:

org.navit_pro

ject.navit.vehicleprofile.get_attr string:”name”

returns:

string "name"
variant       string "car"

org.navit_project.nav

it.vehicleprofile.get_attr string:”static_speed”

returns:

string "static_speed"
variant       int32 5

4.3.6.1.2. set_attr

Path:

.vehicleprofile

Arguments:

string:attribute variant:value

Return:

none

Description:

Sets the specified attribute value. The example below renames the current vehicleprofile. To actually change the vehicleprofile, use the set_attr method in the .vehicle path (see below).

Example:

org.navit_project.navit.vehicleprof

ile.set_attr string:”name” variant:string:”bike”

4.3.7. org.navit_project.navit.vehicle

4.3.7.1. Methods

Examples are shown for each command, and when using on the command line must be prefixed by:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit/default_vehicle

4.3.7.1.1. set_attr

Path:

.vehicle

Arguments:

string:attribute variant:value

Return:

none

Description:

Sets the specified attribute value. The example below changes the current vehicleprofile to "bike" .

Example:

org.navit_project.navit.vehicle.set

_attr string:”profilename” variant:string:”bike”

4.3.8. org.navit_project.navit.route

4.3.8.1. Methods

Examples are shown for each command, and when using on the command line must be prefixed by:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/navit/default_navit/default_route

4.3.8.1.1. get_attr

Path:

.route

Arguments:

string:attribute

Return:

string:attribute variant:value

Description:

Gets the specified attribute value. The attribute can be anything from route_get_attr() in navit/route.c

Example:

org.navit_project.

navit.route.get_attr string:”destination_length”

returns:

string "destination_length"
variant       int32 338111

4.3.9. Signals

4.3.9.1. add bookmark signal

Setup the callback:

`` 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 ``
`` object path “/org/navit_project/navit/callback/0”``
`` 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``

Replace “my_signal” with a signal name of your choice.

Now add a bookmark and you should see this in dbus-monitor –session:

`` signal sender=:1.927 -> dest=(null destination) path=/org/navit_project/navit; interface=org.navit_project.navit; member=my_signal``

4.3.10. Undocumented methods

The following code comes from /binding/dbus/binding_dbus.c

{"",        "attr_iter",           "",        "",                                        "o",  "attr_iter",  request_config_attr_iter},
{"",        "attr_iter_destroy",   "o",       "attr_iter",                               "",   "",      request_config_attr_iter_destroy},
{"",        "get_attr",            "s",       "attrname",                                "sv", "attrname,value",request_config_get_attr},
{"",        "get_attr_wi",         "so",      "attrname,attr_iter",                      "sv", "attrname,value",request_config_get_attr},
{"",        "callback_new",    "s",       "signalname",                              "o",  "callback",request_callback_new},
{"",        "callback_attr_new",   "ss",       "signalname,attribute",                   "o",  "callback",request_callback_new},
{"",        "search_list_new",     "o",       "mapset",                                  "o",  "search",request_search_list_new},
{".callback","destroy",            "",        "",                                        "",   "",      request_callback_destroy},
{".graphics","get_data",       "s",       "type",                    "ay",  "data", request_graphics_get_data},
{".graphics","set_attr",           "sv",      "attribute,value",                         "",   "",      request_graphics_set_attr},
{".gui",     "get_attr",           "s",       "attribute",                               "sv",  "attrname,value", request_gui_get_attr},
{".gui",     "command_parameter",  "sa{sa{sv}}","command,parameter",                     "a{sa{sv}}",  "return", request_gui_command},
{".gui",     "command",            "s",       "command",                                 "a{sa{sv}}",  "return", request_gui_command},

{".navit",  "resize",              "ii",      "upperleft,lowerright",                    "",   "",      request_navit_resize},
{".navit",  "attr_iter",           "",        "",                                        "o",  "attr_iter",  request_navit_attr_iter},
{".navit",  "attr_iter_destroy",   "o",       "attr_iter",                               "",   "",      request_navit_attr_iter_destroy},
{".navit",  "get_attr_wi",         "so",      "attribute,attr_iter",                     "sv",  "attrname,value", request_navit_get_attr},
{".navit",  "add_attr",            "sv",      "attribute,value",                         "",   "",      request_navit_add_attr},
{".navit",  "remove_attr",         "sv",      "attribute,value",                         "",   "",      request_navit_remove_attr},
{".navit",  "evaluate",        "s",       "command",                 "s",  "",      request_navit_evaluate},

{".map",    "get_attr",            "s",       "attribute",                               "sv",  "attrname,value", request_map_get_attr},
{".map",    "set_attr",            "sv",      "attribute,value",                         "",   "",      request_map_set_attr},
{".mapset", "attr_iter",           "",        "",                                        "o",  "attr_iter",  request_mapset_attr_iter},
{".mapset", "attr_iter_destroy",   "o",       "attr_iter",                               "",   "",      request_mapset_attr_iter_destroy},
{".mapset", "get_attr",            "s",       "attribute",                               "sv",  "attrname,value", request_mapset_get_attr},
{".mapset", "get_attr_wi",         "so",      "attribute,attr_iter",                     "sv",  "attrname,value", request_mapset_get_attr},
{".navigation","get_attr",         "s",       "attribute",                               "",   "",      request_navigation_get_attr},
{".route",    "set_attr",          "sv",      "attribute,value",                         "",    "",  request_route_set_attr},
{".route",    "add_attr",          "sv",      "attribute,value",                         "",    "",  request_route_add_attr},
{".route",    "remove_attr",       "sv",      "attribute,value",                         "",    "",  request_route_remove_attr},
{".search_list","destroy",         "",        "",                                        "",   "",      request_search_list_destroy},
{".search_list","get_result",      "",        "",                                        "i(iii)a{sa{sv}}",   "id,coord,dict",      request_search_list_get_result},
{".search_list","search",          "svi",     "attribute,value,partial",                 "",   "",      request_search_list_search},
{".search_list","select",          "sii",     "attribute_type,id,mode",                  "",   "",      request_search_list_select},
{".tracking","get_attr",           "s",       "attribute",                               "",   "",      request_tracking_get_attr},

category: navit dbus category: Development