diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-03-06 08:05:47 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-03-06 08:05:47 +0000 |
commit | ceddb6e4bbaa2a52ec4aef8933e9dd72a3b91a54 (patch) | |
tree | 010805a18558755b8c04d8bed2357ed15ce31bc4 /navit/binding | |
parent | 793f301b602d2e604c221574bbfbf181de265ebe (diff) | |
download | navit-ceddb6e4bbaa2a52ec4aef8933e9dd72a3b91a54.tar.gz |
Add:binding_dbus:Command to dump a map into a given file name
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@6019 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/binding')
-rw-r--r-- | navit/binding/dbus/binding_dbus.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c index b701d4954..f440b9b50 100644 --- a/navit/binding/dbus/binding_dbus.c +++ b/navit/binding/dbus/binding_dbus.c @@ -988,6 +988,31 @@ request_map_set_attr(DBusConnection *connection, DBusMessage *message) return request_set_add_remove_attr(connection, message, "map", NULL, (int (*)(void *, struct attr *))map_set_attr); } +static DBusHandlerResult +request_map_dump(DBusConnection *connection, DBusMessage *message) +{ + DBusMessageIter iter; + struct map *map; + + map=object_get_from_message(message, "map"); + if (! map) + return dbus_error_invalid_object_path(connection, message); + + dbus_message_iter_init(message, &iter); + if(!strcmp(dbus_message_iter_get_signature(&iter), "s")) { + char *file; + FILE *f; + dbus_message_iter_get_basic(&iter, &file); + /* dbg(0,"File '%s'\n",file); */ + f=fopen(file,"w"); + map_dump_filedesc(map,f); + fclose(f); + return empty_reply(connection, message); + } + return dbus_error_invalid_parameter(connection, message); +} + + /* mapset */ static DBusHandlerResult @@ -1818,6 +1843,7 @@ struct dbus_method { {".layout", "get_attr", "s", "attribute", "sv", "attrname,value", request_layout_get_attr}, {".map", "get_attr", "s", "attribute", "sv", "attrname,value", request_map_get_attr}, {".map", "set_attr", "sv", "attribute,value", "", "", request_map_set_attr}, + {".map", "dump", "s", "file", "", "", request_map_dump}, {".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}, |