You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(59) |
Sep
(43) |
Oct
(95) |
Nov
(135) |
Dec
(108) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(229) |
Feb
(141) |
Mar
(59) |
Apr
(70) |
May
(64) |
Jun
(87) |
Jul
(57) |
Aug
(108) |
Sep
(74) |
Oct
(203) |
Nov
(141) |
Dec
(108) |
2009 |
Jan
(114) |
Feb
(91) |
Mar
(101) |
Apr
(69) |
May
(54) |
Jun
(82) |
Jul
(49) |
Aug
(109) |
Sep
(81) |
Oct
(93) |
Nov
(100) |
Dec
(79) |
2010 |
Jan
(46) |
Feb
(36) |
Mar
(135) |
Apr
(103) |
May
(116) |
Jun
(130) |
Jul
(52) |
Aug
(31) |
Sep
(46) |
Oct
(48) |
Nov
(98) |
Dec
(110) |
2011 |
Jan
(234) |
Feb
(184) |
Mar
(150) |
Apr
(43) |
May
(53) |
Jun
(52) |
Jul
(112) |
Aug
(72) |
Sep
(79) |
Oct
(23) |
Nov
(6) |
Dec
(30) |
2012 |
Jan
(39) |
Feb
(37) |
Mar
(49) |
Apr
(60) |
May
(63) |
Jun
(38) |
Jul
(33) |
Aug
(24) |
Sep
(20) |
Oct
(14) |
Nov
(23) |
Dec
(50) |
2013 |
Jan
(30) |
Feb
(32) |
Mar
(27) |
Apr
(41) |
May
(59) |
Jun
(21) |
Jul
(10) |
Aug
(73) |
Sep
(23) |
Oct
(60) |
Nov
(14) |
Dec
(15) |
2014 |
Jan
(4) |
Feb
(8) |
Mar
(11) |
Apr
(6) |
May
(27) |
Jun
(4) |
Jul
(29) |
Aug
(62) |
Sep
(11) |
Oct
(17) |
Nov
(58) |
Dec
(9) |
2015 |
Jan
(23) |
Feb
(3) |
Mar
(26) |
Apr
(47) |
May
(8) |
Jun
(28) |
Jul
(10) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <md...@us...> - 2014-12-21 21:11:26
|
Revision: 5981 http://sourceforge.net/p/navit/code/5981 Author: mdankov Date: 2014-12-21 21:11:23 +0000 (Sun, 21 Dec 2014) Log Message: ----------- Fix:core:uptade attr_def.h missed from previous commit. Modified Paths: -------------- trunk/navit/navit/attr_def.h Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2014-12-21 21:04:29 UTC (rev 5980) +++ trunk/navit/navit/attr_def.h 2014-12-21 21:11:23 UTC (rev 5981) @@ -1,6 +1,6 @@ /* * Navit, a modular navigation system. - * Copyright (C) 2005-2009 Navit Team + * Copyright (C) 2005-2014 Navit Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License @@ -196,11 +196,11 @@ ATTR2(0x00027500,type_rel_abs_begin) /* These attributes are int that can either hold relative * * or absolute values. A relative value is indicated by * - * adding 0x60000000. * - * * + * adding 0x60000000. * + * * * The range of valid absolute values is -0x40000000 to * - * 0x40000000, the range of relative values is from * - * -0x20000000 to 0x20000000. */ + * 0x40000000, the range of relative values is from * + * -0x20000000 to 0x20000000. */ ATTR(h) ATTR(w) ATTR(x) @@ -390,6 +390,10 @@ ATTR(house_number_interpolation_no_ends_incrmt_1) ATTR(house_number_interpolation_no_ends_incrmt_2) ATTR(dbg_level) +ATTR(street_name_systematic_nat) +ATTR(street_name_systematic_int) +ATTR(street_destination) +ATTR(exit_to) ATTR2(0x0003ffff,type_string_end) ATTR2(0x00040000,type_special_begin) ATTR(order) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-12-21 21:04:36
|
Revision: 5980 http://sourceforge.net/p/navit/code/5980 Author: mdankov Date: 2014-12-21 21:04:29 +0000 (Sun, 21 Dec 2014) Log Message: ----------- Add:maptool:Process more osm tags describing way (especially ramp) destination. Part of #1082 fix.|Thank you jandegr Modified Paths: -------------- trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-12-21 13:30:58 UTC (rev 5979) +++ trunk/navit/navit/maptool/osm.c 2014-12-21 21:04:29 UTC (rev 5980) @@ -101,6 +101,11 @@ attr_string_district_name, attr_string_street_name, attr_string_street_name_systematic, + attr_string_street_name_systematic_nat, + attr_string_street_name_systematic_int, + attr_string_ref, + attr_string_exit_to, + attr_string_street_destination, attr_string_house_number, attr_string_label, attr_string_postal, @@ -1161,8 +1166,29 @@ if (! strcmp(k,"ref")) { if (in_way) attr_strings_save(attr_string_street_name_systematic, v); + /* for exit number of highway_exit poi */ + else attr_strings_save(attr_string_ref, v); level=5; } + if (! strcmp(k,"nat_ref")) { + if (in_way) + attr_strings_save(attr_string_street_name_systematic_nat, v); + level=5; + } + if (! strcmp(k,"int_ref")) { + if (in_way) + attr_strings_save(attr_string_street_name_systematic_int, v); + level=5; + } + if (! strcmp(k,"destination")) { + if (in_way) + attr_strings_save(attr_string_street_destination, v); + level=5; + } + if (! strcmp(k,"exit_to")) { + attr_strings_save(attr_string_exit_to, v); + level=5; + } if (! strcmp(k,"openGeoDB:is_in")) { if (!is_in_buffer[0]) g_strlcpy(is_in_buffer, v, sizeof(is_in_buffer)); @@ -1750,6 +1776,8 @@ item_bin_add_attr_string(item_bin, def_flags ? attr_street_name : attr_label, attr_strings[attr_string_label]); item_bin_add_attr_string(item_bin, attr_district_name, attr_strings[attr_string_district_name]); item_bin_add_attr_string(item_bin, attr_street_name_systematic, attr_strings[attr_string_street_name_systematic]); + item_bin_add_attr_string(item_bin, attr_street_name_systematic_nat, attr_strings[attr_string_street_name_systematic_nat]); + item_bin_add_attr_string(item_bin, attr_street_destination, attr_strings[attr_string_street_destination]); item_bin_add_attr_longlong(item_bin, attr_osm_wayid, osmid_attr_value); if (debug_attr_buffer[0]) item_bin_add_attr_string(item_bin, attr_debug, debug_attr_buffer); @@ -1831,6 +1859,8 @@ item_bin_add_attr_string(item_bin, attr_county_name, attr_strings[attr_string_county_name]); item_bin_add_attr_string(item_bin, attr_url, attr_strings[attr_string_url]); item_bin_add_attr_longlong(item_bin, attr_osm_nodeid, osmid_attr_value); + item_bin_add_attr_string(item_bin, attr_ref, attr_strings[attr_string_ref]); + item_bin_add_attr_string(item_bin, attr_exit_to, attr_strings[attr_string_exit_to]); item_bin_add_attr_string(item_bin, attr_debug, debug_attr_buffer); postal=attr_strings[attr_string_postal]; if (postal) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-12-21 13:31:01
|
Revision: 5979 http://sourceforge.net/p/navit/code/5979 Author: mdankov Date: 2014-12-21 13:30:58 +0000 (Sun, 21 Dec 2014) Log Message: ----------- Add:port_android:Allow Android map download and backup/restore dialogs to be called from internal gui, for devices which have no hardware menu button. Modified Paths: -------------- trunk/navit/navit/android/src/org/navitproject/navit/Navit.java trunk/navit/navit/graphics/android/graphics_android.c trunk/navit/navit/xslt/android.xslt Modified: trunk/navit/navit/android/src/org/navitproject/navit/Navit.java =================================================================== --- trunk/navit/navit/android/src/org/navitproject/navit/Navit.java 2014-12-21 13:29:22 UTC (rev 5978) +++ trunk/navit/navit/android/src/org/navitproject/navit/Navit.java 2014-12-21 13:30:58 UTC (rev 5979) @@ -508,8 +508,14 @@ @Override public boolean onOptionsItemSelected(MenuItem item) { + runOptionsItem(item.getItemId()); + return true; + } + + public void runOptionsItem(int id) + { // Handle item selection - switch (item.getItemId()) + switch (id) { case 1 : // zoom in @@ -559,7 +565,6 @@ this.exit(); break; } - return true; } void setDestination(float latitude, float longitude, String address) { Modified: trunk/navit/navit/graphics/android/graphics_android.c =================================================================== --- trunk/navit/navit/graphics/android/graphics_android.c 2014-12-21 13:29:22 UTC (rev 5978) +++ trunk/navit/navit/graphics/android/graphics_android.c 2014-12-21 13:30:58 UTC (rev 5979) @@ -30,6 +30,7 @@ #include "debug.h" #include "callback.h" #include "android.h" +#include "command.h" int dummy; @@ -654,7 +655,7 @@ } static jclass NavitClass; -static jmethodID Navit_disableSuspend, Navit_exit, Navit_fullscreen; +static jmethodID Navit_disableSuspend, Navit_exit, Navit_fullscreen, Navit_runOptionsItem; static int graphics_android_fullscreen(struct window *win, int on) @@ -670,7 +671,24 @@ (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_disableSuspend); } +static void +graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) +{ + int ncmd=0; + dbg(0,"Running %s\n",function); + if(!strcmp(function,"map_download_dialog")) { + ncmd=3; + } else if(!strcmp(function,"backup_restore_dialog")) { + ncmd=7; + } + (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_runOptionsItem, ncmd); +} +static struct command_table commands[] = { + {"map_download_dialog",command_cast(graphics_android_cmd_runMenuItem)}, + {"backup_restore_dialog",command_cast(graphics_android_cmd_runMenuItem)}, +}; + static struct graphics_priv * graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { @@ -689,6 +707,9 @@ if ((attr=attr_search(attrs, NULL, attr_use_camera))) { use_camera=attr->u.num; } + if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), ret); + } image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal); if (graphics_android_init(ret, NULL, NULL, 0, 0, 0, 0, use_camera)) { dbg(lvl_debug,"returning %p\n",ret); @@ -913,6 +934,10 @@ Navit_fullscreen = (*jnienv)->GetMethodID(jnienv, NavitClass, "fullscreen", "(I)V"); if (Navit_fullscreen == NULL) return NULL; + Navit_runOptionsItem = (*jnienv)->GetMethodID(jnienv, NavitClass, "runOptionsItem", "(I)V"); + if (Navit_runOptionsItem == NULL) + return NULL; + dbg(lvl_debug,"ok\n"); *meth=event_android_methods; return NULL; Modified: trunk/navit/navit/xslt/android.xslt =================================================================== --- trunk/navit/navit/xslt/android.xslt 2014-12-21 13:29:22 UTC (rev 5978) +++ trunk/navit/navit/xslt/android.xslt 2014-12-21 13:30:58 UTC (rev 5979) @@ -35,6 +35,13 @@ <xsl:apply-templates/> </xsl:copy> </xsl:template> + <xsl:template match="/config/navit/gui[2]/text()"> + <xsl:value-of select="replace(/config/navit/gui[2]/text(), + '<a name=''Tools''><text>Tools</text>','<a name=''Tools''><text>Tools</text> + <img src=''gui_maps'' onclick=''navit.graphics.map_download_dialog();''><text>Map download</text></img> + <img src=''gui_rules'' onclick=''navit.graphics.backup_restore_dialog();''><text>Backup / Restore</text></img>')"/> + </xsl:template> + <xsl:template match="/config/navit[1]"> <xsl:copy> <xsl:copy-of select="@*"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-12-21 13:29:31
|
Revision: 5978 http://sourceforge.net/p/navit/code/5978 Author: mdankov Date: 2014-12-21 13:29:22 +0000 (Sun, 21 Dec 2014) Log Message: ----------- Add:core:Allow to query graphics attributes (to allow graphics modules to export command interface functions) Modified Paths: -------------- trunk/navit/navit/graphics.c trunk/navit/navit/xmlconfig.c Modified: trunk/navit/navit/graphics.c =================================================================== --- trunk/navit/navit/graphics.c 2014-12-19 23:41:04 UTC (rev 5977) +++ trunk/navit/navit/graphics.c 2014-12-21 13:29:22 UTC (rev 5978) @@ -228,7 +228,7 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) { struct graphics *this_; - struct attr *type_attr; + struct attr *type_attr, cbl_attr; struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl); if (! (type_attr=attr_search(attrs, NULL, attr_type))) { @@ -239,9 +239,12 @@ if (! graphicstype_new) return NULL; this_=g_new0(struct graphics, 1); + this_->attrs=attr_list_dup(attrs); this_->cbl=callback_list_new(); - this_->priv=(*graphicstype_new)(parent->u.navit, &this_->meth, attrs, this_->cbl); - this_->attrs=attr_list_dup(attrs); + cbl_attr.type=attr_callback_list; + cbl_attr.u.callback_list=this_->cbl; + this_->attrs=attr_generic_add_attr(this_->attrs, &cbl_attr); + this_->priv=(*graphicstype_new)(parent->u.navit, &this_->meth, this_->attrs, this_->cbl); this_->brightness=0; this_->contrast=65536; this_->gamma=65536; Modified: trunk/navit/navit/xmlconfig.c =================================================================== --- trunk/navit/navit/xmlconfig.c 2014-12-19 23:41:04 UTC (rev 5977) +++ trunk/navit/navit/xmlconfig.c 2014-12-21 13:29:22 UTC (rev 5978) @@ -238,7 +238,7 @@ { attr_coord, NEW(coord_new_from_attrs)}, { attr_cursor, NEW(cursor_new), NULL, NULL, NULL, NULL, ADD(cursor_add_attr)}, { attr_debug, NEW(debug_new)}, - { attr_graphics, NEW(graphics_new)}, + { attr_graphics, NEW(graphics_new), GET(graphics_get_attr)}, { attr_gui, NEW(gui_new), GET(gui_get_attr), NULL, NULL, SET(gui_set_attr), ADD(gui_add_attr)}, { attr_icon, NEW(icon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_image, NEW(image_new)}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-12-19 23:41:14
|
Revision: 5977 http://sourceforge.net/p/navit/code/5977 Author: sleske Date: 2014-12-19 23:41:04 +0000 (Fri, 19 Dec 2014) Log Message: ----------- Fix:osd:Remove strange, buggy and undocumented code for drawing a box around an OSD item based on attr_flags. Modified Paths: -------------- trunk/navit/navit/osd.c trunk/navit/navit/osd.h Modified: trunk/navit/navit/osd.c =================================================================== --- trunk/navit/navit/osd.c 2014-12-15 15:12:59 UTC (rev 5976) +++ trunk/navit/navit/osd.c 2014-12-19 23:41:04 UTC (rev 5977) @@ -335,9 +335,6 @@ attr=attr_search(attrs, NULL, attr_text_color); if (attr) item->text_color=*attr->u.color; - attr=attr_search(attrs, NULL, attr_flags); - if (attr) - item->attr_flags=attr->u.num; attr=attr_search(attrs, NULL, attr_accesskey); if (attr) item->accesskey = g_strdup(attr->u.str); @@ -421,28 +418,10 @@ osd_std_draw(struct osd_item *item) { struct point p[2]; - int flags=item->attr_flags; - graphics_draw_mode(item->gr, draw_mode_begin); p[0].x=0; p[0].y=0; graphics_draw_rectangle(item->gr, item->graphic_bg, p, item->w, item->h); - p[1].x=item->w-1; - p[1].y=0; - if (flags & 1) - graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2); - p[0].x=item->w-1; - p[0].y=item->h-1; - if (flags & 2) - graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2); - p[1].x=0; - p[1].y=item->h-1; - if (flags & 4) - graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2); - p[0].x=0; - p[0].y=0; - if (flags & 8) - graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2); } struct object_func osd_func = { Modified: trunk/navit/navit/osd.h =================================================================== --- trunk/navit/navit/osd.h 2014-12-15 15:12:59 UTC (rev 5976) +++ trunk/navit/navit/osd.h 2014-12-19 23:41:04 UTC (rev 5977) @@ -39,7 +39,7 @@ struct osd_item { struct point p; struct osd_item_methods meth; - int flags, attr_flags, w, h, fg_line_width, font_size, osd_configuration, configured; + int flags, w, h, fg_line_width, font_size, osd_configuration, configured; int rel_w, rel_h, rel_x, rel_y; struct color color_bg, color_white, text_color; struct navit *navit; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2014-12-15 15:13:02
|
Revision: 5976 http://sourceforge.net/p/navit/code/5976 Author: kazer_ Date: 2014-12-15 15:12:59 +0000 (Mon, 15 Dec 2014) Log Message: ----------- Add:Plugin:Added the j1850 plugin, allows Navit to read CAN-BUS datas in some cars using this protocol Modified Paths: -------------- trunk/navit/CMakeLists.txt Added Paths: ----------- trunk/navit/navit/plugin/j1850/ trunk/navit/navit/plugin/j1850/CMakeLists.txt trunk/navit/navit/plugin/j1850/j1850.c Modified: trunk/navit/CMakeLists.txt =================================================================== --- trunk/navit/CMakeLists.txt 2014-11-26 12:49:37 UTC (rev 5975) +++ trunk/navit/CMakeLists.txt 2014-12-15 15:12:59 UTC (rev 5976) @@ -423,6 +423,7 @@ #Modules without test yet add_module(plugin/pedestrian "Default" FALSE) +add_module(plugin/j1850 "Default" FALSE) add_module(speech/android "Default" FALSE) add_module(speech/espeak "Default" FALSE) add_module(speech/iphone "Default" FALSE) Added: trunk/navit/navit/plugin/j1850/CMakeLists.txt =================================================================== --- trunk/navit/navit/plugin/j1850/CMakeLists.txt (rev 0) +++ trunk/navit/navit/plugin/j1850/CMakeLists.txt 2014-12-15 15:12:59 UTC (rev 5976) @@ -0,0 +1 @@ +module_add_library(plugin_j1850 j1850.c) Added: trunk/navit/navit/plugin/j1850/j1850.c =================================================================== --- trunk/navit/navit/plugin/j1850/j1850.c (rev 0) +++ trunk/navit/navit/plugin/j1850/j1850.c 2014-12-15 15:12:59 UTC (rev 5976) @@ -0,0 +1,499 @@ +/* vim: set tabstop=4 expandtab: */ +/** + * Navit, a modular navigation system. + * Copyright (C) 2005-2008 Navit Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* + This plugin implements a small subset of the SAE j1850 protocal used in some cars. + So far the code assumes that it is run on Linux. It allows Navit to read the steering + wheel inputs and some metrics like RPM or the fuel tank level + */ + +#include <math.h> +#include <stdio.h> +#include <glib.h> +#include <time.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <unistd.h> +#include <termios.h> +#include <errno.h> +#include <sys/ioctl.h> +#include "config.h" +#include <navit/item.h> +#include <navit/xmlconfig.h> +#include <navit/main.h> +#include <navit/debug.h> +#include <navit/map.h> +#include <navit/navit.h> +#include <navit/callback.h> +#include <navit/file.h> +#include <navit/plugin.h> +#include <navit/event.h> +#include <navit/command.h> +#include <navit/config_.h> +#include "graphics.h" +#include "color.h" +#include "osd.h" + +const char *init_string[] = { + "ATZ\r\n", + "ATI\r\n", + "ATL1\r\n", + "ATH1\r\n", + "ATS1\r\n", + "ATAL\r\n", + "ATMA\r\n", + NULL +}; + +struct j1850 { + struct navit *nav; + int status; + int device; + int index; + char message[255]; + char * filename; + struct event_idle *idle; + struct callback *callback; + struct osd_item osd_item; + int width; + struct graphics_gc *orange,*white; + struct callback *click_cb; + int init_string_index; + + int rpm; + int tank_level; + int odo; +}; + +/** + * @brief Generates a fake sentence. Used for debugging + * @param[in] dest - the char * to which we will write the sentence + * lenght - the length of the sentence to generate + * + * @return nothing + * + * Generates a fake string to simulate data from the serial port + * + */ +void rand_str(char *dest, size_t length) { + char charset[] = "0123456789" + "ABCDEF"; + + while (length-- > 0) { + size_t index = (double) rand() / RAND_MAX * (sizeof charset - 1); + *dest++ = charset[index]; + } + *dest = '\0'; +} + +/** + * @brief Writes 'cmd' to the serial port' + * @param[in] cmd - the char * that we will write to the serial port + * device - the serial port device + * + * @return nothing + * + * Write the cmd to the serial port + * + */ +void write_to_serial_port(unsigned char *cmd, int device) +{ + int n_written = 0; + do { + n_written += write( device, &cmd[n_written], 1 ); + } + while (cmd[n_written-1] != '\r' && n_written > 0); + dbg(0,"sent %s to the serial port\n",cmd); +} + +/** + * @brief Function called when navit is idle. Does the continous reading + * @param[in] j1850 - the j1850 struct containing the state of the plugin + * + * @return nothing + * + * This is the main function of this plugin. It is called when navit is idle, + * and performs the initialization of the obd device if needed, then reads + * one char each time it is called, and puts this char in a buffer. When it + * reads an EOL character, the buffer is parsed, and the appropriate action is + * taken. The buffer is then cleared and we start over. + * + */ +static void +j1850_idle(struct j1850 *j1850) +{ + int n; // used to keep track of the numbers of char read from the device + int value; // used to convert the ascii char to an int + char buf = '\0'; // the buffer where we store the char read from the device + char header[3]; // a buffer to store the j1850 header for easier matching + struct timeval tv; // used to timestamp the logs + struct attr navit; + // Make sure we sent all init commands before trying to read + if ( init_string[j1850->init_string_index]) + { + dbg(0,"Sending next init command : %s\n",init_string[j1850->init_string_index]); + if (j1850->device > 0 ){ + write_to_serial_port(init_string[j1850->init_string_index++],j1850->device); + } + + // Did we reach the last init command? + if ( !init_string[j1850->init_string_index]) + { + // if yes, switch to idle read instead of timed read + event_remove_timeout(j1850->idle); + j1850->idle=event_add_idle(125, j1850->callback); + } + return; + } + navit.type=attr_navit; + navit.u.navit=j1850->nav; + + // If not connected, generate random messages for debugging purpose + if (j1850->device < 0 ){ + rand_str(j1850->message,8); + return; + } + + n = read( j1850->device, &buf, 1 ); + if(n == -1) { + dbg(1,"x\n"); + } else if (n==0) { + dbg(1,".\n"); + } else { + if( buf == 13 ) { + gettimeofday(&tv, NULL); + unsigned long long millisecondsSinceEpoch = + (unsigned long long)(tv.tv_sec) * 1000 + + (unsigned long long)(tv.tv_usec) / 1000; + + j1850->message[j1850->index]='\0'; + FILE *fp; + fp = fopen(j1850->filename,"a"); + fprintf(fp, "%llu,%s\n", millisecondsSinceEpoch, j1850->message); + fclose(fp); + strncpy(header, j1850->message, 2); + header[2]='\0'; + if( strncmp(header,"10",2)==0 ) { + char * w1 = strndup(j1850->message+2, 4); + j1850->rpm = ((int)strtol(w1, NULL, 16) ) / 4 ; + } else if( strncmp(header,"3D",2)==0 ) { + if (strcmp(j1850->message, "3D110000EE") == 0) { + // noise + } else if (strcmp(j1850->message, "3D1120009B") == 0) { + dbg(0,"L1\n"); + command_evaluate(&navit, "gui.spotify_volume_up()" ); + } else if (strcmp(j1850->message, "3D110080C8") == 0) { + dbg(0,"L2\n"); + command_evaluate(&navit, "gui.spotify_volume_toggle()" ); + } else if (strcmp(j1850->message, "3D1110005A") == 0) { + dbg(0,"L3\n"); + command_evaluate(&navit, "gui.spotify_volume_down()" ); + } else if (strcmp(j1850->message, "3D110400C3") == 0) { + dbg(0,"R1\n"); + command_evaluate(&navit, "gui.spotify_next_track()" ); + } else if (strcmp(j1850->message, "3D110002D4") == 0) { + dbg(0,"R2\n"); + command_evaluate(&navit, "gui.spotify_toggle()" ); + } else if (strcmp(j1850->message, "3D11020076") == 0) { + dbg(0,"R3\n"); + command_evaluate(&navit, "gui.spotify_previous_track()" ); + } else { + dbg(0,"Got button from %s\n", j1850->message); + } + } else if( strncmp(header,"72",2)==0 ) { + char * data=strndup(j1850->message+2, 8); + j1850->odo=((int)strtol(data, NULL, 16) )/8000; + } else if( strncmp(header,"90",2)==0 ) { + } else if( strncmp(header,"A4",2)==0 ) { + char * w1 =strndup(j1850->message+2, 4); + j1850->tank_level = ((int)strtol(w1, NULL, 16) ) / 4 ; + } else { + // printf(" ascii: %i [%s] with header [%s]\n",buf, response, header); + } + // Message has been processed. Let's clear it + j1850->message[0]='\0'; + j1850->index=0; + } else { + value=buf-48; + if(value==-16 || buf == 10 ){ + //space and newline, discard + return; + } else if (value>16) { + // chars, need to shift down + value-=7; + j1850->message[j1850->index]=buf; + j1850->index++; + } else if (buf == '<' ) { + // We have a data error. Let's truncate the message + j1850->message[j1850->index]='\0'; + j1850->index++; + } else { + j1850->message[j1850->index]=buf; + j1850->index++; + } + // printf("{%c:%i}", buf,value); + } + } +} + +/** + * @brief Draws the j1850 OSD + * @param[in] j1850 - the j1850 struct containing the state of the plugin + * nav - the navit object + * v - the vehicle object + * + * @return nothing + * + * Draws the j1850 OSD. Currently it only displays the last parsed message + * + */ +static void +osd_j1850_draw(struct j1850 *this, struct navit *nav, + struct vehicle *v) +{ + osd_std_draw(&this->osd_item); + + struct point p, bbox[4]; + + graphics_get_text_bbox(this->osd_item.gr, this->osd_item.font, this->message, 0x10000, 0, bbox, 0); + p.x=(this->osd_item.w-bbox[2].x)/2; + p.y = this->osd_item.h-this->osd_item.h/10; + + struct graphics_gc *curr_color = this->white; + // online? use this->bActive?this->white:this->orange; + graphics_draw_text(this->osd_item.gr, curr_color, NULL, this->osd_item.font, this->message, &p, 0x10000, 0); + graphics_draw_mode(this->osd_item.gr, draw_mode_end); +} + +/** + * @brief Initialize the j1850 OSD + * @param[in] j1850 - the j1850 struct containing the state of the plugin + * nav - the navit object + * + * @return nothing + * + * Initialize the j1850 OSD + * + */ +static void +osd_j1850_init(struct j1850 *this, struct navit *nav) +{ + + struct color c; + osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this); + + // Used when debugging or when the device is offline + this->orange = graphics_gc_new(this->osd_item.gr); + c.r = 0xFFFF; + c.g = 0xA5A5; + c.b = 0x0000; + c.a = 65535; + graphics_gc_set_foreground(this->orange, &c); + graphics_gc_set_linewidth(this->orange, this->width); + + // Used when we are receiving real datas from the device + this->white = graphics_gc_new(this->osd_item.gr); + c.r = 65535; + c.g = 65535; + c.b = 65535; + c.a = 65535; + graphics_gc_set_foreground(this->white, &c); + graphics_gc_set_linewidth(this->white, this->width); + + + graphics_gc_set_linewidth(this->osd_item.graphic_fg_white, this->width); + + event_add_timeout(500, 1, callback_new_1(callback_cast(osd_j1850_draw), this)); + + j1850_init_serial_port(this); + + // navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast (osd_j1850_click), attr_button, this)); + + osd_j1850_draw(this, nav, NULL); +} + +/** + * @brief Sends 'cmd' and reads the reply from the device + * @param[in] cmd - the char * that we will write to the serial port + * device - the serial port device + * + * @return nothing + * + * Sends 'cmd' and reads the reply from the device + * + */ +void send_and_read(unsigned char *cmd, int USB) +{ + int n_written = 0; + do { + n_written += write( USB, &cmd[n_written], 1 ); + } + while (cmd[n_written-1] != '\r' && n_written > 0); + + int n = 0; + char buf = '\0'; + + /* Whole response*/ + char response[255]; + + do + { + n = read( USB, &buf, 1 ); + if(n == -1) { + dbg(1,"x"); + } else if (n==0) { + dbg(1,"."); + } else { + dbg(1,"[%s]", &buf); + } + } + while( buf != '\r' && n > 0); + + if (n < 0) { + dbg(0,"Read error\n"); + } else if (n == 0) { + dbg(0,"Nothing to read?\n"); + } else { + dbg(0,"Response : \n"); + } +} + +/** + * @brief Opens the serial port and saves state to the j1850 object + * @param[in] j1850 - the j1850 struct containing the state of the plugin + * + * @return nothing + * + * Opens the serial port and saves state to the j1850 object + * + */ +void +j1850_init_serial_port(struct j1850 *j1850) +{ + j1850->callback=callback_new_1(callback_cast(j1850_idle), j1850); + // Fixme : we should read the device path from the config file + j1850->device = open( "/dev/ttyUSB0", O_RDWR| O_NOCTTY ); + if ( j1850->device < 0 ) + { + dbg(0,"Can't open port\n"); + j1850->idle=event_add_timeout(100, 1, j1850->callback); + return; + } + + struct termios tty; + struct termios tty_old; + memset (&tty, 0, sizeof tty); + + /* Error Handling */ + if ( tcgetattr ( j1850->device, &tty ) != 0 ) + { + dbg(0,"Error\n"); + return; + } + + /* Save old tty parameters */ + tty_old = tty; + + /* Set Baud Rate */ + cfsetospeed (&tty, (speed_t)B115200); + cfsetispeed (&tty, (speed_t)B115200); + + /* Setting other Port Stuff */ + tty.c_cflag &= ~PARENB; // Make 8n1 + tty.c_cflag &= ~CSTOPB; + tty.c_cflag &= ~CSIZE; + tty.c_cflag |= CS8; + + tty.c_cflag &= ~CRTSCTS; // no flow control + tty.c_cc[VMIN] = 1; // read doesn't block + tty.c_cc[VTIME] = 10; // 0.5 seconds read timeout + tty.c_cflag |= CREAD | CLOCAL; // turn on READ & ignore ctrl lines + + /* Make raw */ + cfmakeraw(&tty); + + /* Flush Port, then applies attributes */ + tcflush( j1850->device, TCIFLUSH ); + if ( tcsetattr ( j1850->device, TCSANOW, &tty ) != 0) + { + dbg(0,"Flush error\n"); + return; + } + + dbg(0,"Port init ok\n"); + // For the init part, we want to wait 1sec before each init string + j1850->idle=event_add_timeout(1000, 1, j1850->callback); +} + +/** + * @brief Creates the j1850 OSD and set some default properties + * @param[in] nav - the navit object + * meth - the osd_methods + * attrs - pointer to the attributes + * + * @return nothing + * + * Creates the j1850 OSD and set some default properties + * + */ +static struct osd_priv * +osd_j1850_new(struct navit *nav, struct osd_methods *meth, + struct attr **attrs) +{ + struct j1850 *this=g_new0(struct j1850, 1); + this->nav=nav; + time_t current_time = time(NULL); + // FIXME : make sure that the directory we log to exists! + this->filename=g_strdup_printf("/home/navit/.navit/obd/%i.log",current_time); + dbg(0,"Will log to %s\n", this->filename); + this->init_string_index=0; + struct attr *attr; + this->osd_item.p.x = 120; + this->osd_item.p.y = 20; + this->osd_item.w = 160; + this->osd_item.h = 20; + this->osd_item.navit = nav; + this->osd_item.font_size = 200; + this->osd_item.meth.draw = osd_draw_cast(osd_j1850_draw); + + osd_set_std_attr(attrs, &this->osd_item, 2); + attr = attr_search(attrs, NULL, attr_width); + this->width=attr ? attr->u.num : 2; + navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_j1850_init), attr_graphics_ready, this)); + return (struct osd_priv *) this; +} + +/** + * @brief The plugin entry point + * + * @return nothing + * + * The plugin entry point + * + */ +void +plugin_init(void) +{ + struct attr callback,navit; + struct attr_iter *iter; + + plugin_register_osd_type("j1850", osd_j1850_new); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-26 12:49:42
|
Revision: 5975 http://sourceforge.net/p/navit/code/5975 Author: sleske Date: 2014-11-26 12:49:37 +0000 (Wed, 26 Nov 2014) Log Message: ----------- Add:osd:Log error if toggle_announcer configured but no speech available. Modified Paths: -------------- trunk/navit/navit/osd/core/osd_core.c Modified: trunk/navit/navit/osd/core/osd_core.c =================================================================== --- trunk/navit/navit/osd/core/osd_core.c 2014-11-26 12:49:18 UTC (rev 5974) +++ trunk/navit/navit/osd/core/osd_core.c 2014-11-26 12:49:37 UTC (rev 5975) @@ -1858,7 +1858,12 @@ char *gui_sound_on = "gui_sound"; struct attr attr, speechattr; - if (!navit_get_attr(navit, attr_speech, &speechattr, NULL) || !speech_get_attr(speechattr.u.speech, attr_active, &attr, NULL)) + if (!navit_get_attr(navit, attr_speech, &speechattr, NULL)) + { + dbg(lvl_error, "No speech plugin available, toggle_announcer disabled.\n"); + return; + } + if (!speech_get_attr(speechattr.u.speech, attr_active, &attr, NULL)) attr.u.num = 1; this->active = attr.u.num; @@ -1868,7 +1873,7 @@ do_draw = 1; } - if (do_draw) + if (do_draw) { graphics_draw_mode(opc->osd_item.gr, draw_mode_begin); p.x = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-26 12:49:27
|
Revision: 5974 http://sourceforge.net/p/navit/code/5974 Author: sleske Date: 2014-11-26 12:49:18 +0000 (Wed, 26 Nov 2014) Log Message: ----------- Fix:core:Check if speech output is available, to avoid crashing. Modified Paths: -------------- trunk/navit/navit/navit.c Modified: trunk/navit/navit/navit.c =================================================================== --- trunk/navit/navit/navit.c 2014-11-26 12:49:07 UTC (rev 5973) +++ trunk/navit/navit/navit.c 2014-11-26 12:49:18 UTC (rev 5974) @@ -2775,7 +2775,11 @@ attr->u.route=this_->route; break; case attr_speech: - attr->u.speech=this_->speech; + if(this_->speech) { + attr->u.speech=this_->speech; + } else { + return 0; + } break; case attr_timeout: attr->u.num=this_->center_timeout; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-26 12:49:11
|
Revision: 5973 http://sourceforge.net/p/navit/code/5973 Author: sleske Date: 2014-11-26 12:49:07 +0000 (Wed, 26 Nov 2014) Log Message: ----------- Fix:core:Complete rename navit_vehicle_update -> navit_vehicle_update_position from r5954. Revision Links: -------------- http://sourceforge.net/p/navit/code/5954 Modified Paths: -------------- trunk/navit/navit/navit.c Modified: trunk/navit/navit/navit.c =================================================================== --- trunk/navit/navit/navit.c 2014-11-25 19:40:04 UTC (rev 5972) +++ trunk/navit/navit/navit.c 2014-11-26 12:49:07 UTC (rev 5973) @@ -176,7 +176,7 @@ } u; }; -static void navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv); +static void navit_vehicle_update_position(struct navit *this_, struct navit_vehicle *nv); static void navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point *pnt); static int navit_add_vehicle(struct navit *this_, struct vehicle *v); static int navit_set_attr_do(struct navit *this_, struct attr *attr, int init); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-11-25 19:40:16
|
Revision: 5972 http://sourceforge.net/p/navit/code/5972 Author: mdankov Date: 2014-11-25 19:40:04 +0000 (Tue, 25 Nov 2014) Log Message: ----------- Fix:port/win32:Tune debug output level Modified Paths: -------------- trunk/navit/navit/main.c Modified: trunk/navit/navit/main.c =================================================================== --- trunk/navit/navit/main.c 2014-11-25 11:56:50 UTC (rev 5971) +++ trunk/navit/navit/main.c 2014-11-25 19:40:04 UTC (rev 5972) @@ -315,13 +315,13 @@ #endif while (nls_table[i][0]) { if (!strcmp(nls_table[i][0], lang) && !(strcmp(nls_table[i][1], country))) { - dbg(lvl_warning,"Setting LANG=%s for Lang %s Country %s\n",nls_table[i][2], lang, country); + dbg(lvl_info,"Setting LANG=%s for Lang %s Country %s\n",nls_table[i][2], lang, country); setenv("LANG",nls_table[i][2],0); return; } i++; } - dbg(lvl_warning,"Lang %s Country %s not found\n",lang,country); + dbg(lvl_error,"Lang %s Country %s not found\n",lang,country); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wog...@us...> - 2014-11-25 11:56:59
|
Revision: 5971 http://sourceforge.net/p/navit/code/5971 Author: woglinde Date: 2014-11-25 11:56:50 +0000 (Tue, 25 Nov 2014) Log Message: ----------- Fix:android:fix vehcile file, which introduced a broken merge with svn revision 5967 Revision Links: -------------- http://sourceforge.net/p/navit/code/5967 Modified Paths: -------------- trunk/navit/navit/vehicle/android/vehicle_android.c Modified: trunk/navit/navit/vehicle/android/vehicle_android.c =================================================================== --- trunk/navit/navit/vehicle/android/vehicle_android.c 2014-11-22 23:36:19 UTC (rev 5970) +++ trunk/navit/navit/vehicle/android/vehicle_android.c 2014-11-25 11:56:50 UTC (rev 5971) @@ -235,55 +235,20 @@ return 0; if (!android_find_class_global("org/navitproject/navit/NavitVehicle", &ret->NavitVehicleClass)) return 0; -<<<<<<< HEAD -<<<<<<< HEAD - dbg(0,"at 3\n"); + dbg(lvl_debug,"at 3\n"); cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;III)V"); -||||||| merged common ancestors - dbg(0,"at 3\n"); - cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;I)V"); -======= - dbg(lvl_error,"at 3\n"); -||||||| merged common ancestors - dbg(lvl_error,"at 3\n"); -======= - dbg(lvl_debug,"at 3\n"); ->>>>>>> Fix:core:Change all logging at lvl_error/warning to lvl_debug, unless it looks like an error message.|#1269, part 5 - cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;I)V"); ->>>>>>> Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269. if (cid == NULL) { dbg(lvl_error,"no method found\n"); return 0; /* exception thrown */ } -<<<<<<< HEAD -<<<<<<< HEAD - dbg(0,"at 4 android_activity=%p\n",android_activity); - ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->pcb, (int) ret->scb, (int) ret->fcb); - dbg(0,"result=%p\n",ret->NavitVehicle); -||||||| merged common ancestors - dbg(0,"at 4 android_activity=%p\n",android_activity); - ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->cb); - dbg(0,"result=%p\n",ret->NavitVehicle); -======= - dbg(lvl_error,"at 4 android_activity=%p\n",android_activity); -||||||| merged common ancestors - dbg(lvl_error,"at 4 android_activity=%p\n",android_activity); -======= - dbg(lvl_debug,"at 4 android_activity=%p\n",android_activity); ->>>>>>> Fix:core:Change all logging at lvl_error/warning to lvl_debug, unless it looks like an error message.|#1269, part 5 - ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->cb); -<<<<<<< HEAD - dbg(lvl_error,"result=%p\n",ret->NavitVehicle); ->>>>>>> Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269. -||||||| merged common ancestors - dbg(lvl_error,"result=%p\n",ret->NavitVehicle); -======= + dbg(lvl_debug, "at 4 android_activity=%p\n", android_activity); + ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, + (int) ret->pcb, (int) ret->scb, (int) ret->fcb); dbg(lvl_debug,"result=%p\n",ret->NavitVehicle); ->>>>>>> Fix:core:Change all logging at lvl_error/warning to lvl_debug, unless it looks like an error message.|#1269, part 5 if (!ret->NavitVehicle) return 0; if (ret->NavitVehicle) - ret->NavitVehicle = (*jnienv)->NewGlobalRef(jnienv, ret->NavitVehicle); + ret->NavitVehicle = (*jnienv)->NewGlobalRef(jnienv, ret->NavitVehicle); return 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 23:36:23
|
Revision: 5970 http://sourceforge.net/p/navit/code/5970 Author: sleske Date: 2014-11-22 23:36:19 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:core:Fix compilation for Windows. Modified Paths: -------------- trunk/navit/navit/debug.c Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:36:55 UTC (rev 5969) +++ trunk/navit/navit/debug.c 2014-11-22 23:36:19 UTC (rev 5970) @@ -281,7 +281,7 @@ debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap) { #if defined HAVE_API_WIN32_CE || defined _MSC_VER - char debug_headers[4096]; + char message_origin[4096]; #else char message_origin[mlen+flen+3]; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:37:03
|
Revision: 5969 http://sourceforge.net/p/navit/code/5969 Author: sleske Date: 2014-11-22 22:36:55 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Add:core:Allow setting the debug level by name in navit.xml.|#1269, last part Modified Paths: -------------- trunk/navit/navit/attr_def.h trunk/navit/navit/debug.c trunk/navit/navit/navit_shipped.xml Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2014-11-22 22:36:38 UTC (rev 5968) +++ trunk/navit/navit/attr_def.h 2014-11-22 22:36:55 UTC (rev 5969) @@ -389,6 +389,7 @@ * exclude the end nodes, because these are imported as separate nodes. */ ATTR(house_number_interpolation_no_ends_incrmt_1) ATTR(house_number_interpolation_no_ends_incrmt_2) +ATTR(dbg_level) ATTR2(0x0003ffff,type_string_end) ATTR2(0x00040000,type_special_begin) ATTR(order) Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:36:38 UTC (rev 5968) +++ trunk/navit/navit/debug.c 2014-11-22 22:36:55 UTC (rev 5969) @@ -135,14 +135,43 @@ } } +static dbg_level +parse_dbg_level(struct attr *dbg_level_attr, struct attr *level_attr) +{ + if (dbg_level_attr) { + if(!strcmp(dbg_level_attr->u.str,"error")){ + return lvl_error; + } + if(!strcmp(dbg_level_attr->u.str,"warning")){ + return lvl_warning; + } + if(!strcmp(dbg_level_attr->u.str,"info")){ + return lvl_info; + } + if(!strcmp(dbg_level_attr->u.str,"debug")){ + return lvl_debug; + } + dbg(lvl_error, "Invalid debug level in config: '%s'\n", dbg_level_attr->u.str); + } else if (level_attr) { + if (level_attr->u.num>= lvl_error && + level_attr->u.num<= lvl_debug) + return level_attr->u.num; + dbg(lvl_error, "Invalid debug level in config: %ld\n", level_attr->u.num); + } + return lvl_unset; +} + struct debug * debug_new(struct attr *parent, struct attr **attrs) { - struct attr *name,*level; + struct attr *name,*dbg_level_attr,*level_attr; + dbg_level level; name=attr_search(attrs, NULL, attr_name); - level=attr_search(attrs, NULL, attr_level); + dbg_level_attr=attr_search(attrs, NULL, attr_dbg_level); + level_attr=attr_search(attrs, NULL, attr_level); + level = parse_dbg_level(dbg_level_attr,level_attr); #ifdef HAVE_SOCKET - if (!name && !level) { + if (!name && level==lvl_unset) { struct attr *socket_attr=attr_search(attrs, NULL, attr_socket); char *p,*s; if (!socket_attr) @@ -166,9 +195,9 @@ return (struct debug *)&dummy; } #endif - if (!name || !level) + if (!name || level==lvl_unset) return NULL; - debug_level_set(name->u.str, level->u.num); + debug_level_set(name->u.str, level); return (struct debug *)&dummy; } Modified: trunk/navit/navit/navit_shipped.xml =================================================================== --- trunk/navit/navit/navit_shipped.xml 2014-11-22 22:36:38 UTC (rev 5968) +++ trunk/navit/navit/navit_shipped.xml 2014-11-22 22:36:55 UTC (rev 5969) @@ -15,11 +15,12 @@ </plugins> <!-- The global debug level (like using command line option "-d"). Ignored if option -d is used. --> - <debug name="global" level="0"/> + <!-- Possible debug levels: error, warning, info, debug. --> + <debug name="global" dbg_level="error"/> <!-- Example of setting the debug level for a single function. --> - <debug name="navit:do_draw" level="0"/> + <debug name="navit:do_draw" dbg_level="error"/> <!-- This is here so one can copy&paste the contents of popup menus --> - <debug name="navit:popup_printf_cb" level="3"/> + <debug name="navit:popup_printf_cb" dbg_level="debug"/> <!-- segv: 1 - show backtrace with gdb and exit, 2 - stay in gdb --> <debug name="segv" level="1"/> <!-- timestamps 0/1 - prefix log messages with a timestamp --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:36:45
|
Revision: 5968 http://sourceforge.net/p/navit/code/5968 Author: sleske Date: 2014-11-22 22:36:38 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:xml:Adapt debug level in config.|#1269, part 6 Modified Paths: -------------- trunk/navit/navit/navit_shipped.xml Modified: trunk/navit/navit/navit_shipped.xml =================================================================== --- trunk/navit/navit/navit_shipped.xml 2014-11-22 22:36:24 UTC (rev 5967) +++ trunk/navit/navit/navit_shipped.xml 2014-11-22 22:36:38 UTC (rev 5968) @@ -19,7 +19,7 @@ <!-- Example of setting the debug level for a single function. --> <debug name="navit:do_draw" level="0"/> <!-- This is here so one can copy&paste the contents of popup menus --> - <debug name="navit:popup_printf_cb" level="0"/> + <debug name="navit:popup_printf_cb" level="3"/> <!-- segv: 1 - show backtrace with gdb and exit, 2 - stay in gdb --> <debug name="segv" level="1"/> <!-- timestamps 0/1 - prefix log messages with a timestamp --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:36:29
|
Revision: 5967 http://sourceforge.net/p/navit/code/5967 Author: sleske Date: 2014-11-22 22:36:24 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:core:Change all logging at lvl_error/warning to lvl_debug, unless it looks like an error message.|#1269, part 5 Modified Paths: -------------- trunk/navit/navit/android.c trunk/navit/navit/attr.c trunk/navit/navit/autoload/osso/osso.c trunk/navit/navit/binding/dbus/binding_dbus.c trunk/navit/navit/binding/python/config.c trunk/navit/navit/binding/python/navit.c trunk/navit/navit/binding/python/pcoord.c trunk/navit/navit/binding/win32/binding_win32.c trunk/navit/navit/bookmarks.c trunk/navit/navit/cache.c trunk/navit/navit/command.c trunk/navit/navit/config_.c trunk/navit/navit/coord.c trunk/navit/navit/debug.c trunk/navit/navit/file.c trunk/navit/navit/font/freetype/font_freetype.c trunk/navit/navit/graphics/android/graphics_android.c trunk/navit/navit/graphics/gd/graphics_gd.c trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c trunk/navit/navit/graphics/null/graphics_null.c trunk/navit/navit/graphics/opengl/graphics_opengl.c trunk/navit/navit/graphics/opengl/graphics_opengl_egl.c trunk/navit/navit/graphics/opengl/graphics_opengl_x11.c trunk/navit/navit/graphics/qt_qpainter/RenderArea.cpp trunk/navit/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp trunk/navit/navit/graphics/sdl/event.c trunk/navit/navit/graphics/sdl/event_sdl.c trunk/navit/navit/graphics/sdl/graphics_sdl.c trunk/navit/navit/graphics/win32/graphics_win32.c trunk/navit/navit/graphics.c trunk/navit/navit/gui/gtk/datawindow.c trunk/navit/navit/gui/gtk/destination.c trunk/navit/navit/gui/gtk/gui_gtk_poi.c trunk/navit/navit/gui/gtk/gui_gtk_window.c trunk/navit/navit/gui/internal/gui_internal.c trunk/navit/navit/gui/internal/gui_internal_bookmark.c trunk/navit/navit/gui/internal/gui_internal_command.c trunk/navit/navit/gui/internal/gui_internal_gesture.c trunk/navit/navit/gui/internal/gui_internal_html.c trunk/navit/navit/gui/internal/gui_internal_menu.c trunk/navit/navit/gui/internal/gui_internal_poi.c trunk/navit/navit/gui/internal/gui_internal_search.c trunk/navit/navit/gui/internal/gui_internal_widget.c trunk/navit/navit/gui/qml/bookmarksProxy.h trunk/navit/navit/gui/qml/gui_qml.cpp trunk/navit/navit/gui/qml/navitProxy.h trunk/navit/navit/gui/qml/proxy.h trunk/navit/navit/gui/qml/routeProxy.h trunk/navit/navit/gui/qml/searchProxy.h trunk/navit/navit/gui/win32/gui_win32.c trunk/navit/navit/gui/win32/win32_gui_destination.c trunk/navit/navit/linguistics.c trunk/navit/navit/log.c trunk/navit/navit/map/binfile/binfile.c trunk/navit/navit/map/csv/csv.c trunk/navit/navit/map/csv/quadtree.c trunk/navit/navit/map/filter/filter.c trunk/navit/navit/map/mg/block.c trunk/navit/navit/map/mg/map.c trunk/navit/navit/map/mg/poly.c trunk/navit/navit/map/mg/street.c trunk/navit/navit/map/mg/town.c trunk/navit/navit/map/mg/tree.c trunk/navit/navit/map/shapefile/shapefile.c trunk/navit/navit/map/textfile/textfile.c trunk/navit/navit/map.c trunk/navit/navit/maps.c trunk/navit/navit/mapset.c trunk/navit/navit/maptool/ch.c trunk/navit/navit/maptool/coastline.c trunk/navit/navit/navigation.c trunk/navit/navit/navit.c trunk/navit/navit/osd/core/osd_core.c trunk/navit/navit/osd.c trunk/navit/navit/plugin/pedestrian/pedestrian.c trunk/navit/navit/plugin.c trunk/navit/navit/popup.c trunk/navit/navit/profile.c trunk/navit/navit/profile_option.c trunk/navit/navit/projection.c trunk/navit/navit/route.c trunk/navit/navit/routech.c trunk/navit/navit/script.c trunk/navit/navit/search.c trunk/navit/navit/search_houseno_interpol.c trunk/navit/navit/speech/android/speech_android.c trunk/navit/navit/speech/cmdline/speech_cmdline.c trunk/navit/navit/speech/espeak/speak.c trunk/navit/navit/speech.c trunk/navit/navit/start_real.c trunk/navit/navit/support/libc/stat.c trunk/navit/navit/support/win32/serial_io.c trunk/navit/navit/support/wordexp/glob.c trunk/navit/navit/track.c trunk/navit/navit/transform.c trunk/navit/navit/util.c trunk/navit/navit/vehicle/android/vehicle_android.c trunk/navit/navit/vehicle/demo/vehicle_demo.c trunk/navit/navit/vehicle/file/vehicle_file.c trunk/navit/navit/vehicle/gpsd/vehicle_gpsd.c trunk/navit/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c trunk/navit/navit/vehicle/gypsy/vehicle_gypsy.c trunk/navit/navit/vehicle/iphone/vehicle_iphone.c trunk/navit/navit/vehicle/maemo/vehicle_maemo.c trunk/navit/navit/vehicle/null/vehicle_null.c trunk/navit/navit/vehicle/webos/bluetooth.c trunk/navit/navit/vehicle/webos/vehicle_webos.c trunk/navit/navit/vehicle/wince/vehicle_wince.c trunk/navit/navit/vehicle.c trunk/navit/navit/vehicleprofile.c trunk/navit/navit/xmlconfig.c Modified: trunk/navit/navit/android.c =================================================================== --- trunk/navit/navit/android.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/android.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -83,12 +83,12 @@ jnienv=env; android_activity = (*jnienv)->NewGlobalRef(jnienv, activity); langstr=(*env)->GetStringUTFChars(env, lang, NULL); - dbg(lvl_error,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,android_activity,langstr,version); + dbg(lvl_debug,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,android_activity,langstr,version); setenv("LANG",langstr,1); (*env)->ReleaseStringUTFChars(env, lang, langstr); displaydensitystr=(*env)->GetStringUTFChars(env, display_density_string, NULL); - dbg(lvl_error,"*****displaydensity=%s\n",displaydensitystr); + dbg(lvl_debug,"*****displaydensity=%s\n",displaydensitystr); setenv("ANDROID_DENSITY",displaydensitystr,1); (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr); const char *strings=(*env)->GetStringUTFChars(env, path, NULL); @@ -99,14 +99,14 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_Navit_NavitDestroy( JNIEnv* env) { - dbg(lvl_error, "shutdown navit\n"); + dbg(lvl_debug, "shutdown navit\n"); exit(0); } JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobject thiz, int id, int w, int h) { - dbg(lvl_error,"enter %p %d %d\n",(struct callback *)id,w,h); + dbg(lvl_debug,"enter %p %d %d\n",(struct callback *)id,w,h); if (id) callback_call_2((struct callback *)id,w,h); } @@ -114,7 +114,7 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_ButtonCallback( JNIEnv* env, jobject thiz, int id, int pressed, int button, int x, int y) { - dbg(lvl_warning,"enter %p %d %d\n",(struct callback *)id,pressed,button); + dbg(lvl_debug,"enter %p %d %d\n",(struct callback *)id,pressed,button); if (id) callback_call_4((struct callback *)id,pressed,button,x,y); } @@ -122,7 +122,7 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_MotionCallback( JNIEnv* env, jobject thiz, int id, int x, int y) { - dbg(lvl_warning,"enter %p %d %d\n",(struct callback *)id,x,y); + dbg(lvl_debug,"enter %p %d %d\n",(struct callback *)id,x,y); if (id) callback_call_2((struct callback *)id,x,y); } @@ -131,9 +131,9 @@ Java_org_navitproject_navit_NavitGraphics_KeypressCallback( JNIEnv* env, jobject thiz, int id, jobject str) { const char *s; - dbg(lvl_error,"enter %p %p\n",(struct callback *)id,str); + dbg(lvl_debug,"enter %p %p\n",(struct callback *)id,str); s=(*env)->GetStringUTFChars(env, str, NULL); - dbg(lvl_error,"key=%d",s); + dbg(lvl_debug,"key=%d",s); if (id) callback_call_1((struct callback *)id,s); (*env)->ReleaseStringUTFChars(env, str, s); @@ -143,7 +143,7 @@ Java_org_navitproject_navit_NavitTimeout_TimeoutCallback( JNIEnv* env, jobject thiz, int id) { void (*event_handler)(void *) = *(void **)id; - dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id); + dbg(lvl_debug,"enter %p %p\n",thiz, (void *)id); event_handler((void*)id); } @@ -156,7 +156,7 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitIdle_IdleCallback( JNIEnv* env, jobject thiz, int id) { - dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id); + dbg(lvl_debug,"enter %p %p\n",thiz, (void *)id); callback_call_0((struct callback *)id); } @@ -171,14 +171,14 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitWatch_WatchCallback( JNIEnv* env, jobject thiz, int id) { - dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id); + dbg(lvl_debug,"enter %p %p\n",thiz, (void *)id); callback_call_0((struct callback *)id); } JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitSensors_SensorCallback( JNIEnv* env, jobject thiz, int id, int sensor, float x, float y, float z) { - dbg(lvl_warning,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z); + dbg(lvl_debug,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z); callback_call_4((struct callback *)id, sensor, &x, &y, &z); } @@ -208,10 +208,10 @@ const char *localized_str; s=(*env)->GetStringUTFChars(env, str, NULL); - //dbg(lvl_error,"*****string=%s\n",s); + //dbg(lvl_debug,"*****string=%s\n",s); localized_str=navit_nls_gettext(s); - //dbg(lvl_error,"localized string=%s",localized_str); + //dbg(lvl_debug,"localized string=%s",localized_str); // jstring dataStringValue = (jstring) localized_str; jstring js = (*env)->NewStringUTF(env,localized_str); @@ -227,7 +227,7 @@ struct attr attr; const char *s; jint ret = 0; - dbg(lvl_error,"enter %d %p\n",channel,str); + dbg(lvl_debug,"enter %d %p\n",channel,str); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -248,7 +248,7 @@ struct mapset *ms = navit_get_mapset(attr.u.navit); struct attr type, name, data, *attrs[4]; const char *map_location=(*env)->GetStringUTFChars(env, str, NULL); - dbg(lvl_error,"*****string=%s\n",map_location); + dbg(lvl_debug,"*****string=%s\n",map_location); type.type=attr_type; type.u.str="binfile"; @@ -280,7 +280,7 @@ if (delete_map) { - dbg(lvl_error,"delete map %s (%p)", map_location, delete_map); + dbg(lvl_debug,"delete map %s (%p)", map_location, delete_map); map_r.type=attr_map; map_r.u.map=delete_map; ret = mapset_remove_attr(ms, &map_r); @@ -292,7 +292,7 @@ case 5: // call a command (like in gui) s=(*env)->GetStringUTFChars(env, str, NULL); - dbg(lvl_error,"*****string=%s\n",s); + dbg(lvl_debug,"*****string=%s\n",s); command_evaluate(&attr,s); (*env)->ReleaseStringUTFChars(env, str, s); break; @@ -310,7 +310,7 @@ char parse_str[strlen(s) + 1]; strcpy(parse_str, s); (*env)->ReleaseStringUTFChars(env, str, s); - dbg(lvl_error,"*****string=%s\n",parse_str); + dbg(lvl_debug,"*****string=%s\n",parse_str); // set destination to (pixel-x#pixel-y) // pixel-x @@ -320,8 +320,8 @@ pstr = strtok (NULL, "#"); p.y = atoi(pstr); - dbg(lvl_error,"11x=%d\n",p.x); - dbg(lvl_error,"11y=%d\n",p.y); + dbg(lvl_debug,"11x=%d\n",p.x); + dbg(lvl_debug,"11y=%d\n",p.y); transform_reverse(transform, &p, &c); @@ -330,8 +330,8 @@ pc.y = c.y; pc.pro = transform_get_projection(transform); - dbg(lvl_error,"22x=%d\n",pc.x); - dbg(lvl_error,"22y=%d\n",pc.y); + dbg(lvl_debug,"22x=%d\n",pc.x); + dbg(lvl_debug,"22y=%d\n",pc.y); // start navigation asynchronous navit_set_destination(attr.u.navit, &pc, parse_str, 1); @@ -345,7 +345,7 @@ char parse_str[strlen(s) + 1]; strcpy(parse_str, s); (*env)->ReleaseStringUTFChars(env, str, s); - dbg(lvl_error,"*****string=%s\n",s); + dbg(lvl_debug,"*****string=%s\n",s); // set destination to (lat#lon#title) struct coord_geo g; @@ -361,9 +361,9 @@ // description name = strtok (NULL, "#"); - dbg(lvl_error,"lat=%f\n",g.lat); - dbg(lvl_error,"lng=%f\n",g.lng); - dbg(lvl_error,"str1=%s\n",name); + dbg(lvl_debug,"lat=%f\n",g.lat); + dbg(lvl_debug,"lng=%f\n",g.lng); + dbg(lvl_debug,"str1=%s\n",name); struct coord c; transform_from_geo(projection_mg, &g, &c); @@ -379,7 +379,7 @@ } break; default: - dbg(lvl_error, "Unknown command"); + dbg(lvl_error, "Unknown command: %d", channel); } return ret; @@ -394,7 +394,7 @@ jstring return_string = NULL; struct attr attr; - dbg(lvl_error,"enter %d %p\n",channel,str); + dbg(lvl_debug,"enter %d %p\n",channel,str); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -409,12 +409,12 @@ struct mapset *ms=navit_get_mapset(attr.u.navit); struct search_list *search_list = search_list_new(ms); search_attr.type=attr_country_all; - dbg(lvl_error,"country %s\n", country_name.u.str); + dbg(lvl_debug,"country %s\n", country_name.u.str); search_attr.u.str=country_name.u.str; search_list_search(search_list, &search_attr, 0); while((res=search_list_get_result(search_list))) { - dbg(lvl_error,"Get result: %s\n", res->country->iso2); + dbg(lvl_debug,"Get result: %s\n", res->country->iso2); } if (item_attr_get(item, attr_country_iso2, &country_iso2)) return_string = (*env)->NewStringUTF(env,country_iso2.u.str); @@ -435,7 +435,7 @@ jobjectArray all_countries; struct attr attr; - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -443,12 +443,12 @@ struct search_list *search_list = search_list_new(ms); jobjectArray current_country = NULL; search_attr.type=attr_country_all; - //dbg(lvl_error,"country %s\n", country_name.u.str); + //dbg(lvl_debug,"country %s\n", country_name.u.str); search_attr.u.str=g_strdup("");//country_name.u.str; search_list_search(search_list, &search_attr, 1); while((res=search_list_get_result(search_list))) { - dbg(lvl_error,"Get result: %s\n", res->country->iso2); + dbg(lvl_debug,"Get result: %s\n", res->country->iso2); if (strlen(res->country->iso2)==2) { @@ -543,7 +543,7 @@ static void android_search_end(struct android_search_priv *search_priv) { - dbg(lvl_warning, "End search"); + dbg(lvl_debug, "End search"); JNIEnv* env = search_priv->search_result_obj.env; if (search_priv->idle_ev) { event_remove_idle(search_priv->idle_ev); @@ -575,11 +575,11 @@ static void android_search_idle(struct android_search_priv *search_priv) { - dbg(lvl_warning, "enter android_search_idle"); + dbg(lvl_debug, "enter android_search_idle"); struct search_list_result *res = search_list_get_result(search_priv->search_list); if (res) { - dbg(lvl_warning, "Town: %s, Street: %s\n",res->town ? res->town->common.town_name : "no town", res->street ? res->street->name : "no street"); + dbg(lvl_debug, "Town: %s, Street: %s\n",res->town ? res->town->common.town_name : "no town", res->street ? res->street->name : "no street"); search_priv->found = 1; switch (search_priv->search_attr.type) { @@ -634,7 +634,7 @@ } } while (level > 0 ? search_priv->current_phrase_per_level[level] == search_priv->current_phrase_per_level[level-1] : 0); dbg(lvl_info, "used phrase: %d,%d, %d, level %d, '%s'", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level, attr_to_name(android_search_level[level])) - dbg(lvl_warning, "Search for '%s'", search_priv->phrases[search_priv->current_phrase_per_level[level]]); + dbg(lvl_debug, "Search for '%s'", search_priv->phrases[search_priv->current_phrase_per_level[level]]); search_priv->search_attr.type = android_search_level[level]; search_priv->search_attr.u.str = search_priv->phrases[search_priv->current_phrase_per_level[level]]; struct attr test; @@ -677,12 +677,12 @@ static void start_search(struct android_search_priv *search_priv, const char *search_string) { - dbg(lvl_warning,"enter %s\n", search_string); + dbg(lvl_debug,"enter %s\n", search_string); char *str=search_fix_spaces(search_string); search_priv->phrases = g_strsplit(str, " ", 0); //ret=search_address_town(ret, sl, phrases, NULL, partial, jni); - dbg(lvl_warning,"First search phrase %s", search_priv->phrases[0]); + dbg(lvl_debug,"First search phrase %s", search_priv->phrases[0]); search_priv->search_attr.u.str= search_priv->phrases[0]; search_priv->search_attr.type=attr_town_or_district_name; search_list_search(search_priv->search_list, &search_priv->search_attr, search_priv->partial); @@ -692,7 +692,7 @@ //callback_call_0(search_priv->idle_clb); g_free(str); - dbg(lvl_warning,"leave\n"); + dbg(lvl_debug,"leave\n"); } JNIEXPORT jlong JNICALL @@ -700,7 +700,7 @@ { struct attr attr; const char *search_string =(*env)->GetStringUTFChars(env, str, NULL); - dbg(lvl_error,"search '%s'\n", search_string); + dbg(lvl_debug,"search '%s'\n", search_string); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -733,7 +733,7 @@ if (!count) dbg(lvl_error,"Country not found"); - dbg(lvl_warning,"search in country '%s'\n", str_country); + dbg(lvl_debug,"search in country '%s'\n", str_country); (*env)->ReleaseStringUTFChars(env, country, str_country); search_priv->search_result_obj.env = env; Modified: trunk/navit/navit/attr.c =================================================================== --- trunk/navit/navit/attr.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/attr.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -278,7 +278,7 @@ transform_to_geo(projection_mg, &c, g); break; } - dbg(lvl_warning,"default\n"); + dbg(lvl_debug,"default\n"); g_free(ret); ret=NULL; } @@ -887,7 +887,7 @@ int len=0,quoted; char *p,*e,*n; - dbg(lvl_warning,"get_tag %s from %s\n", name, line); + dbg(lvl_debug,"get_tag %s from %s\n", name, line); if (name) len=strlen(name); if (pos) Modified: trunk/navit/navit/autoload/osso/osso.c =================================================================== --- trunk/navit/navit/autoload/osso/osso.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/autoload/osso/osso.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -33,7 +33,7 @@ static gboolean osso_cb_hw_state_idle(struct cb_hw_state_trail * params) { - dbg(lvl_error, "(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n", + dbg(lvl_debug, "(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n", params->state->system_inactivity_ind, params->state->save_unsaved_data_ind, params->state->shutdown_ind, params->state->memory_low_ind, params->state->sig_device_mode_ind); @@ -69,7 +69,7 @@ static void osso_navit(struct navit *nav, int add) { - dbg(lvl_warning, "Installing osso context for org.navit_project.navit\n"); + dbg(lvl_debug, "Installing osso context for org.navit_project.navit\n"); osso_context = osso_initialize("org.navit_project.navit", version, TRUE, NULL); if (osso_context == NULL) { dbg(lvl_error, "error initiating osso context\n"); Modified: trunk/navit/navit/binding/dbus/binding_dbus.c =================================================================== --- trunk/navit/navit/binding/dbus/binding_dbus.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/binding/dbus/binding_dbus.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -84,7 +84,7 @@ { int id; char *ret; - dbg(lvl_warning,"enter %s\n", type); + dbg(lvl_debug,"enter %s\n", type); if ((ret=g_hash_table_lookup(object_hash_rev, object))) return ret; id=GPOINTER_TO_INT(g_hash_table_lookup(object_count, type)); @@ -92,7 +92,7 @@ ret=g_strdup_printf("%s/%s/%d", object_path, type, id); g_hash_table_insert(object_hash, ret, object); g_hash_table_insert(object_hash_rev, object, ret); - dbg(lvl_warning,"return %s\n", ret); + dbg(lvl_debug,"return %s\n", ret); return (ret); } @@ -151,7 +151,7 @@ if (!config_get_attr(config, attr_navit, &navit, NULL)) return NULL; if (!oprefix[0]) { - dbg(lvl_error,"default_navit\n"); + dbg(lvl_debug,"default_navit\n"); return navit.u.navit; } if (!strncmp(oprefix,def_graphics,strlen(def_graphics))) { @@ -382,42 +382,42 @@ switch (arg) { case DBUS_TYPE_INT32: dbus_message_iter_get_basic(iter, &vali); - dbg(lvl_error,"%sDBUS_TYPE_INT32: %d\n",prefix,vali); + dbg(lvl_debug,"%sDBUS_TYPE_INT32: %d\n",prefix,vali); break; case DBUS_TYPE_STRING: dbus_message_iter_get_basic(iter, &vals); - dbg(lvl_error,"%sDBUS_TYPE_STRING: %s\n",prefix,vals); + dbg(lvl_debug,"%sDBUS_TYPE_STRING: %s\n",prefix,vals); break; case DBUS_TYPE_STRUCT: - dbg(lvl_error,"%sDBUS_TYPE_STRUCT:\n",prefix); + dbg(lvl_debug,"%sDBUS_TYPE_STRUCT:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; case DBUS_TYPE_VARIANT: - dbg(lvl_error,"%sDBUS_TYPE_VARIANT:\n",prefix); + dbg(lvl_debug,"%sDBUS_TYPE_VARIANT:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; case DBUS_TYPE_DICT_ENTRY: - dbg(lvl_error,"%sDBUS_TYPE_DICT_ENTRY:\n",prefix); + dbg(lvl_debug,"%sDBUS_TYPE_DICT_ENTRY:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; case DBUS_TYPE_ARRAY: - dbg(lvl_error,"%sDBUS_TYPE_ARRAY:\n",prefix); + dbg(lvl_debug,"%sDBUS_TYPE_ARRAY:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; default: - dbg(lvl_error,"%c\n",arg); + dbg(lvl_debug,"%c\n",arg); } dbus_message_iter_next(iter); } @@ -517,7 +517,7 @@ dbus_message_iter_get_basic(iter, &attr_type); dbus_message_iter_next(iter); ret=attr_from_name(attr_type); - dbg(lvl_warning, "attr value: 0x%x string: %s\n", ret, attr_type); + dbg(lvl_debug, "attr value: 0x%x string: %s\n", ret, attr_type); return ret; } @@ -534,7 +534,7 @@ dbus_message_iter_recurse(iter, &iterattr); dbus_message_iter_next(iter); - dbg(lvl_warning, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr)); + dbg(lvl_debug, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr)); if (attr->type >= attr_type_item_begin && attr->type <= attr_type_item_end) return 0; @@ -1121,7 +1121,7 @@ { DBusMessageIter iter2; - dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(iter)); + dbg(lvl_debug,"%s\n", dbus_message_iter_get_signature(iter)); dbus_message_iter_recurse(iter, &iter2); @@ -1135,7 +1135,7 @@ return 0; dbus_message_iter_get_basic(&iter2, &p->y); - dbg(lvl_error, " x -> %x y -> %x\n", p->x, p->y); + dbg(lvl_debug, " x -> %x y -> %x\n", p->x, p->y); dbus_message_iter_next(&iter2); @@ -1268,7 +1268,7 @@ return dbus_error_invalid_object_path(connection, message); dbus_message_iter_init(message, &iter); - dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(&iter)); + dbg(lvl_debug,"%s\n", dbus_message_iter_get_signature(&iter)); dbus_message_iter_get_basic(&iter, &factor); @@ -1313,7 +1313,7 @@ pp=&p; } - dbg(lvl_warning,"Dumping route from dbus to %s\n", filename); + dbg(lvl_debug,"Dumping route from dbus to %s\n", filename); struct map * map=NULL; struct navigation * nav = NULL; @@ -1392,7 +1392,7 @@ return dbus_error_invalid_object_path(connection, message); dbus_message_iter_init(message, &iter); - dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(&iter)); + dbg(lvl_debug,"%s\n", dbus_message_iter_get_signature(&iter)); if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) return dbus_error_invalid_parameter(connection, message); @@ -1404,7 +1404,7 @@ return dbus_error_invalid_parameter(connection, message); dbus_message_iter_get_basic(&iter, &h); - dbg(lvl_error, " w -> %i h -> %i\n", w, h); + dbg(lvl_debug, " w -> %i h -> %i\n", w, h); navit_handle_resize(navit, w, h); @@ -1503,7 +1503,7 @@ dbus_message_iter_next(&iter); dbus_message_iter_get_basic(&iter, &description); - dbg(lvl_error, " destination -> %s\n", description); + dbg(lvl_debug, " destination -> %s\n", description); navit_set_destination(navit, &pc, description, 1); return empty_reply(connection, message); @@ -1865,7 +1865,7 @@ if (strncmp(object, object_path, strlen(object_path))) return NULL; ret=g_strdup(object+strlen(object_path)); - dbg(lvl_warning,"path=%s\n",ret); + dbg(lvl_debug,"path=%s\n",ret); for (i = strlen(ret)-1 ; i >= 0 ; i--) { if (ret[i] == '/' || (ret[i] >= '0' && ret[i] <= '9')) ret[i]='\0'; @@ -1893,7 +1893,7 @@ char *path=introspect_path(object); if (!path) return NULL; - dbg(lvl_warning,"path=%s\n",path); + dbg(lvl_debug,"path=%s\n",path); // write header and make navit introspectable navitintrospectxml = g_strdup_printf("%s%s%s\n", navitintrospectxml_head1, object, navitintrospectxml_head2); @@ -1936,11 +1936,11 @@ { int i; char *path; - dbg(lvl_warning,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); + dbg(lvl_debug,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) { DBusMessage *reply; char *navitintrospectxml = generate_navitintrospectxml(dbus_message_get_path(message)); - dbg(lvl_warning,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml); + dbg(lvl_debug,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml); if (navitintrospectxml) { reply = dbus_message_new_method_return(message); dbus_message_append_args(reply, DBUS_TYPE_STRING, &navitintrospectxml, DBUS_TYPE_INVALID); @@ -1974,7 +1974,7 @@ DBusHandlerResult filter(DBusConnection *connection, DBusMessage *message, void *user_data) { - dbg(lvl_error,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); + dbg(lvl_debug,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -1987,7 +1987,7 @@ DBusMessage* msg; char *opath=object_new("navit",navit); char *interface=g_strdup_printf("%s%s", service_name, ".navit"); - dbg(lvl_error,"enter %s %s %s\n",opath,command,interface); + dbg(lvl_debug,"enter %s %s %s\n",opath,command,interface); msg = dbus_message_new_signal(opath, interface, "signal"); if (msg) { DBusMessageIter iter1,iter2,iter3; @@ -2042,7 +2042,7 @@ object_hash=g_hash_table_new(g_str_hash, g_str_equal); object_hash_rev=g_hash_table_new(NULL, NULL); object_count=g_hash_table_new(g_str_hash, g_str_equal); - dbg(lvl_warning,"enter\n"); + dbg(lvl_debug,"enter\n"); dbus_error_init(&error); #ifdef DBUS_USE_SYSTEM_BUS connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); Modified: trunk/navit/navit/binding/python/config.c =================================================================== --- trunk/navit/navit/binding/python/config.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/binding/python/config.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -66,7 +66,7 @@ { configObject *ret; - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); ret=PyObject_NEW(configObject, &config_Type); return (PyObject *)ret; } Modified: trunk/navit/navit/binding/python/navit.c =================================================================== --- trunk/navit/navit/binding/python/navit.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/binding/python/navit.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -47,7 +47,7 @@ dbg(lvl_error,"get_attr not ok\n"); Py_RETURN_NONE; } - dbg(lvl_error,"get_attr ok\n"); + dbg(lvl_debug,"get_attr ok\n"); return python_object_from_attr(&attr); } @@ -131,7 +131,7 @@ { navitObject *ret; - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); ret=PyObject_NEW(navitObject, &navit_Type); return (PyObject *)ret; } @@ -139,7 +139,7 @@ PyObject * navit_py_ref(struct navit *navit) { - dbg(lvl_error,"navit=%p\n", navit); + dbg(lvl_debug,"navit=%p\n", navit); navitObject *ret=PyObject_NEW(navitObject, &navit_Type); ret->navit=navit; return (PyObject *)ret; Modified: trunk/navit/navit/binding/python/pcoord.c =================================================================== --- trunk/navit/navit/binding/python/pcoord.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/binding/python/pcoord.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -76,7 +76,7 @@ ret->pc.pro=pro; ret->pc.x=c.x; ret->pc.y=c.y; - dbg(lvl_error,"0x%x,0x%x\n", c.x, c.y); + dbg(lvl_debug,"0x%x,0x%x\n", c.x, c.y); return (PyObject *)ret; } Modified: trunk/navit/navit/binding/win32/binding_win32.c =================================================================== --- trunk/navit/navit/binding/win32/binding_win32.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/binding/win32/binding_win32.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -63,7 +63,7 @@ dbg(lvl_error,"this function is a stub\n"); if (in) { while (*in) { - dbg(lvl_error,"another attribute to be sent\n"); + dbg(lvl_debug,"another attribute to be sent\n"); in++; } } @@ -100,7 +100,7 @@ dbg(lvl_error,"Got request with wrong MAGIC, expected %s, got %*s.\n",NAVIT_BINDING_W32_MAGIC, msg->magic,sizeof(msg->magic)); return; } - dbg(lvl_error,"Running command %s\n", msg->text); + dbg(lvl_debug,"Running command %s\n", msg->text); command_evaluate(&navit, msg->text); } @@ -120,9 +120,9 @@ win32_main_navit(struct win32_binding_private *this, struct navit *navit, int added) { struct attr attr; - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); if (added==1) { - dbg(lvl_error,"enter2\n"); + dbg(lvl_debug,"enter2\n"); this->navit=navit; command_add_table_attr(commands, sizeof(commands)/sizeof(struct command_table), navit, &attr); navit_add_attr(navit, &attr); @@ -137,7 +137,7 @@ { struct attr callback; struct win32_binding_private *this=g_new0(struct win32_binding_private,1); - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); callback.type=attr_callback; callback.u.callback=callback_new_attr_1(callback_cast(win32_main_navit),attr_navit,this); config_add_attr(config, &callback); Modified: trunk/navit/navit/bookmarks.c =================================================================== --- trunk/navit/navit/bookmarks.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/bookmarks.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -207,7 +207,7 @@ finder=b_item->label; while ((pos=strchr(finder,'/'))) { *pos=0x00; - dbg(lvl_warning,"Found path entry: %s\n",finder); + dbg(lvl_debug,"Found path entry: %s\n",finder); if (!bookmarks_move_down(this_,finder)) { struct bookmark_item_priv *path_item=g_new0(struct bookmark_item_priv,1); path_item->type=type_bookmark_folder; @@ -231,7 +231,7 @@ this_->bookmarks_list=g_list_append(this_->bookmarks_list,b_item); this_->current->children=g_list_append(this_->current->children,b_item); this_->current->children=g_list_first(this_->current->children); - dbg(lvl_warning,"Added %s to %s and current list now %u long\n",b_item->label,this_->current->label,g_list_length(this_->current->children)); + dbg(lvl_debug,"Added %s to %s and current list now %u long\n",b_item->label,this_->current->label,g_list_length(this_->current->children)); } bookmarks_move_root(this_); } @@ -327,7 +327,7 @@ g_free(fullname); fullname=g_strdup(pathHelper); g_free(pathHelper); - dbg(lvl_warning,"full name: %s\n",fullname); + dbg(lvl_debug,"full name: %s\n",fullname); } } Modified: trunk/navit/navit/cache.c =================================================================== --- trunk/navit/navit/cache.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/cache.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -33,13 +33,13 @@ cache_entry_dump(struct cache *cache, struct cache_entry *entry) { int i,size; - dbg(lvl_error,"Usage: %d size %d\n",entry->usage, entry->size); + dbg(lvl_debug,"Usage: %d size %d\n",entry->usage, entry->size); if (cache) size=cache->id_size; else size=5; for (i = 0 ; i < size ; i++) { - dbg(lvl_error,"0x%x\n", entry->id[i]); + dbg(lvl_debug,"0x%x\n", entry->id[i]); } } @@ -47,7 +47,7 @@ cache_list_dump(char *str, struct cache *cache, struct cache_entry_list *list) { struct cache_entry *first=list->first; - dbg(lvl_error,"dump %s %d\n",str, list->size); + dbg(lvl_debug,"dump %s %d\n",str, list->size); while (first) { cache_entry_dump(cache, first); first=first->next; @@ -152,7 +152,7 @@ static void cache_remove(struct cache *cache, struct cache_entry *entry) { - dbg(lvl_warning,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_debug,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); g_hash_table_remove(cache->hash, (gpointer)(entry->id)); g_slice_free1(entry->size, entry); } @@ -185,7 +185,7 @@ last=list->last; if (! last || last->usage || seen >= list->size) return NULL; - dbg(lvl_warning,"removing %d\n", last->id[0]); + dbg(lvl_debug,"removing %d\n", last->id[0]); cache_remove_lru_helper(list); if (cache) { cache_remove(cache, last); @@ -211,7 +211,7 @@ cache_entry_destroy(struct cache *cache, void *data) { struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size); - dbg(lvl_warning,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_debug,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); entry->usage--; } @@ -219,8 +219,8 @@ cache_trim(struct cache *cache, struct cache_entry *entry) { struct cache_entry *new_entry; - dbg(lvl_warning,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); - dbg(lvl_warning,"Trim %x from %d -> %d\n", entry->id[0], entry->size, cache->size); + dbg(lvl_debug,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_debug,"Trim %x from %d -> %d\n", entry->id[0], entry->size, cache->size); if ( cache->entry_size < entry->size ) { g_hash_table_remove(cache->hash, (gpointer)(entry->id)); @@ -256,11 +256,11 @@ cache_replace(struct cache *cache) { if (cache->t1.size >= MAX(1,cache->t1_target)) { - dbg(lvl_warning,"replace 12\n"); + dbg(lvl_debug,"replace 12\n"); if (!cache_move(cache, &cache->t1, &cache->b1)) cache_move(cache, &cache->t2, &cache->b2); } else { - dbg(lvl_warning,"replace t2\n"); + dbg(lvl_debug,"replace t2\n"); if (!cache_move(cache, &cache->t2, &cache->b2)) cache_move(cache, &cache->t1, &cache->b1); } @@ -298,17 +298,17 @@ cache_lookup(struct cache *cache, void *id) { struct cache_entry *entry; - dbg(lvl_warning,"get %d\n", ((int *)id)[0]); + dbg(lvl_debug,"get %d\n", ((int *)id)[0]); entry=g_hash_table_lookup(cache->hash, id); if (entry == NULL) { cache->insert=&cache->t1; #ifdef DEBUG_CACHE fprintf(stderr,"-"); #endif - dbg(lvl_warning,"not in cache\n"); + dbg(lvl_debug,"not in cache\n"); return NULL; } - dbg(lvl_warning,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_debug,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); if (entry->where == &cache->t1 || entry->where == &cache->t2) { cache->hits+=entry->size; #ifdef DEBUG_CACHE @@ -317,7 +317,7 @@ else fprintf(stderr,"H"); #endif - dbg(lvl_warning,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2"); + dbg(lvl_debug,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2"); cache_remove_from_list(entry->where, entry); cache_insert_mru(NULL, &cache->t2, entry); entry->usage++; @@ -327,14 +327,14 @@ #ifdef DEBUG_CACHE fprintf(stderr,"m"); #endif - dbg(lvl_warning,"in phantom cache B1\n"); + dbg(lvl_debug,"in phantom cache B1\n"); cache->t1_target=MIN(cache->t1_target+MAX(cache->b2.size/cache->b1.size, 1),cache->size); cache_remove_from_list(&cache->b1, entry); } else if (entry->where == &cache->b2) { #ifdef DEBUG_CACHE fprintf(stderr,"M"); #endif - dbg(lvl_warning,"in phantom cache B2\n"); + dbg(lvl_debug,"in phantom cache B2\n"); cache->t1_target=MAX(cache->t1_target-MAX(cache->b1.size/cache->b2.size, 1),0); cache_remove_from_list(&cache->b2, entry); } else { @@ -351,7 +351,7 @@ cache_insert(struct cache *cache, void *data) { struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size); - dbg(lvl_warning,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_debug,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); if (cache->insert == &cache->t1) { if (cache->t1.size + cache->b1.size >= cache->size) { if (cache->t1.size < cache->size) { @@ -382,8 +382,8 @@ static void cache_stats(struct cache *cache) { - dbg(lvl_error,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target); - dbg(lvl_error,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size); + dbg(lvl_debug,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target); + dbg(lvl_debug,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size); cache->hits=0; cache->misses=0; } @@ -396,6 +396,6 @@ cache_list_dump("B1", cache, &cache->b1); cache_list_dump("T2", cache, &cache->t2); cache_list_dump("B2", cache, &cache->b2); - dbg(lvl_error,"dump end\n"); + dbg(lvl_debug,"dump end\n"); } Modified: trunk/navit/navit/command.c =================================================================== --- trunk/navit/navit/command.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/command.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -152,8 +152,8 @@ if (res->attrn) strncpy(attribute, res->attrn, res->attrnlen); attribute[res->attrnlen]='\0'; - dbg(lvl_error,"type:%s\n", attr_to_name(res->attr.type)); - dbg(lvl_error,"attribute '%s' from '%s'\n", attribute, object); + dbg(lvl_debug,"type:%s\n", attr_to_name(res->attr.type)); + dbg(lvl_debug,"attribute '%s' from '%s'\n", attribute, object); #endif } @@ -315,7 +315,7 @@ return res->attr.u.data != NULL; if (is_bool && ATTR_IS_STRING(res->attr.type)) return res->attr.u.data != NULL; - dbg(lvl_error,"bool %d %s\n",is_bool,attr_to_name(res->attr.type)); + dbg(lvl_debug,"bool %d %s\n",is_bool,attr_to_name(res->attr.type)); ctx->error=wrong_type; return 0; } @@ -657,7 +657,7 @@ if (res->attrn) strncpy(function, res->attrn, res->attrnlen); function[res->attrnlen]='\0'; - dbg(lvl_warning,"function=%s\n", function); + dbg(lvl_debug,"function=%s\n", function); if (ctx->expr[0] != ')') { list=eval_list(ctx); if (ctx->error) { @@ -716,7 +716,7 @@ if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) { int valid =0; struct attr **out=NULL; - dbg(lvl_warning,"function call %s from %s\n",function, attr_to_name(res->attr.type)); + dbg(lvl_debug,"function call %s from %s\n",function, attr_to_name(res->attr.type)); callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, &out, &valid); if (valid!=1){ dbg(lvl_error, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/" @@ -801,7 +801,7 @@ return; } } else if (op[0] == '(') { - dbg(lvl_warning,"function call\n"); + dbg(lvl_debug,"function call\n"); resolve_object(ctx, res); command_call_function(ctx, res); } @@ -989,7 +989,7 @@ memset(&tmp,0,sizeof(tmp)); if (!get_op(ctx,0,":",NULL)) { - dbg(lvl_error,"ctxerr\n"); + dbg(lvl_debug,"ctxerr\n"); ctx->error=missing_colon; return; } @@ -1110,7 +1110,7 @@ return attr_none; resolve_object(&ctx, &res); *ret=res.attr; - dbg(lvl_warning,"type %s\n",attr_to_name(command_attr_type(&res))); + dbg(lvl_debug,"type %s\n",attr_to_name(command_attr_type(&res))); return command_attr_type(&res); } Modified: trunk/navit/navit/config_.c =================================================================== --- trunk/navit/navit/config_.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/config_.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -60,7 +60,7 @@ static void config_terminate(int sig) { - dbg(lvl_error,"terminating\n"); + dbg(lvl_debug,"terminating\n"); config_destroy(config); } Modified: trunk/navit/navit/coord.c =================================================================== --- trunk/navit/navit/coord.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/coord.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -171,14 +171,14 @@ struct coord c,offset; enum projection str_pro=projection_none; - dbg(lvl_warning,"enter('%s',%d,%p)\n", coord_input, output_projection, result); + dbg(lvl_debug,"enter('%s',%d,%p)\n", coord_input, output_projection, result); s=strchr(str,' '); co=strchr(str,':'); if (co && co < s) { proj=malloc(co-str+1); strncpy(proj, str, co-str); proj[co-str]='\0'; - dbg(lvl_warning,"projection=%s\n", proj); + dbg(lvl_debug,"projection=%s\n", proj); str=co+1; s=strchr(str,' '); if (!strcmp(proj, "geo")) @@ -202,8 +202,8 @@ args=sscanf(str, "%i %i%n",&c.x, &c.y, &ret); if (args < 2) goto out; - dbg(lvl_warning,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret); - dbg(lvl_warning,"rest='%s'\n", str+ret); + dbg(lvl_debug,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret); + dbg(lvl_debug,"rest='%s'\n", str+ret); if (str_pro == projection_none) str_pro=projection_mg; @@ -215,13 +215,13 @@ } else if (*s == 'N' || *s == 'n' || *s == 'S' || *s == 's') { double lng, lat; char ns, ew; - dbg(lvl_warning,"str='%s'\n", str); + dbg(lvl_debug,"str='%s'\n", str); args=sscanf(str, "%lf %c %lf %c%n", &lat, &ns, &lng, &ew, &ret); - dbg(lvl_warning,"args=%d\n", args); - dbg(lvl_warning,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew); + dbg(lvl_debug,"args=%d\n", args); + dbg(lvl_debug,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew); if (args < 4) goto out; - dbg(lvl_warning,"projection=%d str_pro=%d projection_none=%d\n", output_projection, str_pro, projection_none); + dbg(lvl_debug,"projection=%d str_pro=%d projection_none=%d\n", output_projection, str_pro, projection_none); if (str_pro == projection_none) { g.lat=floor(lat/100); lat-=g.lat*100; @@ -233,9 +233,9 @@ g.lat=-g.lat; if (ew == 'w' || ew == 'W') g.lng=-g.lng; - dbg(lvl_warning,"transform_from_geo(%f,%f)",g.lat,g.lng); + dbg(lvl_debug,"transform_from_geo(%f,%f)",g.lat,g.lng); transform_from_geo(output_projection, &g, result); - dbg(lvl_warning,"result 0x%x,0x%x\n", result->x,result->y); + dbg(lvl_debug,"result 0x%x,0x%x\n", result->x,result->y); } dbg(lvl_debug,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret); dbg(lvl_debug,"rest='%s'\n", str+ret); @@ -256,8 +256,8 @@ args=sscanf(str, "%lf %lf%n", &lng, &lat, &ret); if (args < 2) goto out; - dbg(lvl_warning,"str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret); - dbg(lvl_warning,"rest='%s'\n", str+ret); + dbg(lvl_debug,"str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret); + dbg(lvl_debug,"rest='%s'\n", str+ret); g.lng=lng; g.lat=lat; transform_from_geo(output_projection, &g, result); Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/debug.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -358,7 +358,7 @@ { struct malloc_head *head=malloc_heads; int i; - dbg(lvl_error,"mallocs %d\n",mallocs); + dbg(lvl_debug,"mallocs %d\n",mallocs); while (head) { fprintf(stderr,"unfreed malloc from %s of size %d\n",head->where,head->size); for (i = 0 ; i < 8 ; i++) @@ -381,7 +381,7 @@ debug_malloc_size+=size; if (debug_malloc_size/(1024*1024) != debug_malloc_size_m) { debug_malloc_size_m=debug_malloc_size/(1024*1024); - dbg(lvl_error,"malloced %d kb\n",debug_malloc_size/1024); + dbg(lvl_debug,"malloced %d kb\n",debug_malloc_size/1024); } head=malloc(size+sizeof(*head)+sizeof(*tail)); head->magic=0xdeadbeef; Modified: trunk/navit/navit/file.c =================================================================== --- trunk/navit/navit/file.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/file.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -112,7 +112,7 @@ { char *request=g_strdup_printf("%s %s HTTP/1.0\r\nUser-Agent: navit %s\r\nHost: %s\r\n%s%s%s\r\n",method,path,version,host,persistent?"Connection: Keep-Alive\r\n":"",header?header:"",header?"\r\n":""); write(file->fd, request, strlen(request)); - dbg(lvl_warning,"%s\n",request); + dbg(lvl_debug,"%s\n",request); file->requests++; } @@ -149,7 +149,7 @@ host[path-name-7]='\0'; if (port) *port++='\0'; - dbg(lvl_warning,"host=%s path=%s\n",host,path); + dbg(lvl_debug,"host=%s path=%s\n",host,path); if (connect) file->fd=file_socket_connect(host,port?port:"80"); file_http_request(file,method,host,path,header,persistent); @@ -223,11 +223,11 @@ g_free(file); return NULL; } - dbg(lvl_warning,"fd=%d\n", file->fd); + dbg(lvl_debug,"fd=%d\n", file->fd); file->size=lseek(file->fd, 0, SEEK_END); if (file->size < 0) file->size=0; - dbg(lvl_warning,"size="LONGLONG_FMT"\n", file->size); + dbg(lvl_debug,"size="LONGLONG_FMT"\n", file->size); file->name_id = (long)atom(name); } #ifdef CACHE_SIZE @@ -282,7 +282,7 @@ char *buffer=g_alloca(sizeof(char)*(strlen(name)+1)); int ret; char *next; - dbg(lvl_warning,"enter %s %d\n",name,pflag); + dbg(lvl_debug,"enter %s %d\n",name,pflag); if (!pflag) { if (file_is_dir(name)) return 0; @@ -380,7 +380,7 @@ if (*sep == ' ') sep++; strtolower(tok, tok); - dbg(lvl_warning,"header '%s'='%s'\n",tok,sep); + dbg(lvl_debug,"header '%s'='%s'\n",tok,sep); g_hash_table_insert(file->headers, tok, sep); headers=NULL; } @@ -424,10 +424,10 @@ eof=1; } if (file->requests) { - dbg(lvl_warning,"checking header\n"); + dbg(lvl_debug,"checking header\n"); if ((hdr=file_http_header_end(file->buffer, file->buffer_len))) { hdr[-1]='\0'; - dbg(lvl_warning,"found %s\n",file->buffer); + dbg(lvl_debug,"found %s\n",file->buffer); file_process_headers(file, file->buffer); file_shift_buffer(file, hdr-file->buffer); file->requests--; @@ -461,7 +461,7 @@ if (file->cache) { struct file_cache_id id={offset,size,file->name_id,0}; cache_flush(file_cache,&id); - dbg(lvl_warning,"Flushing "LONGLONG_FMT" %d bytes\n",offset,size); + dbg(lvl_debug,"Flushing "LONGLONG_FMT" %d bytes\n",offset,size); } } @@ -832,7 +832,7 @@ ret->pattern=g_strdup(pattern); ret->err=wordexp(pattern, &ret->we, 0); if (ret->err) - dbg(lvl_error,"wordexp('%s') returned %d\n", pattern, ret->err); + dbg(lvl_debug,"wordexp('%s') returned %d\n", pattern, ret->err); return ret; } @@ -886,7 +886,7 @@ file->mtime=st.st_mtime; file->ctime=st.st_ctime; file->version++; - dbg(lvl_warning,"%s now version %d\n", file->name, file->version); + dbg(lvl_debug,"%s now version %d\n", file->name, file->version); } } return file->version; Modified: trunk/navit/navit/font/freetype/font_freetype.c =================================================================== --- trunk/navit/navit/font/freetype/font_freetype.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/font/freetype/font_freetype.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -351,14 +351,14 @@ if (! face_id) return FT_Err_Invalid_Handle; fontfile=g_strdup((char *)face_id); - dbg(lvl_warning,"fontfile=%s\n", fontfile); + dbg(lvl_debug,"fontfile=%s\n", fontfile); fontindex=strrchr(fontfile,'/'); if (! fontindex) { g_free(fontfile); return FT_Err_Invalid_Handle; } *fontindex++='\0'; - dbg(lvl_warning,"new face %s %d\n", fontfile, atoi(fontindex)); + dbg(lvl_debug,"new face %s %d\n", fontfile, atoi(fontindex)); ret = FT_New_Face( library, fontfile, atoi(fontindex), aface ); if(ret) { dbg(lvl_error,"Error while creating freetype face: %d\n", ret); Modified: trunk/navit/navit/graphics/android/graphics_android.c =================================================================== --- trunk/navit/navit/graphics/android/graphics_android.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/graphics/android/graphics_android.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -222,18 +222,18 @@ jclass localBitmap = NULL; int id; - dbg(lvl_warning,"enter %s\n",path); + dbg(lvl_debug,"enter %s\n",path); if (!strncmp(path,"res/drawable/",13)) { jstring a=(*jnienv)->NewStringUTF(jnienv, "drawable"); char *path_noext=g_strdup(path+13); char *pos=strrchr(path_noext, '.'); if (pos) *pos='\0'; - dbg(lvl_warning,"path_noext=%s\n",path_noext); + dbg(lvl_debug,"path_noext=%s\n",path_noext); string = (*jnienv)->NewStringUTF(jnienv, path_noext); g_free(path_noext); id=(*jnienv)->CallIntMethod(jnienv, gra->Resources, gra->Resources_getIdentifier, string, a, gra->packageName); - dbg(lvl_warning,"id=%d\n",id); + dbg(lvl_debug,"id=%d\n",id); if (id) localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeResource, gra->Resources, id); (*jnienv)->DeleteLocalRef(jnienv, a); @@ -241,13 +241,13 @@ string = (*jnienv)->NewStringUTF(jnienv, path); localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeFile, string); } - dbg(lvl_warning,"result=%p\n",localBitmap); + dbg(lvl_debug,"result=%p\n",localBitmap); if (localBitmap) { ret->Bitmap = (*jnienv)->NewGlobalRef(jnienv, localBitmap); (*jnienv)->DeleteLocalRef(jnienv, localBitmap); ret->width=(*jnienv)->CallIntMethod(jnienv, ret->Bitmap, gra->Bitmap_getWidth); ret->height=(*jnienv)->CallIntMethod(jnienv, ret->Bitmap, gra->Bitmap_getHeight); - dbg(lvl_warning,"w=%d h=%d for %s\n",ret->width,ret->height,path); + dbg(lvl_debug,"w=%d h=%d for %s\n",ret->width,ret->height,path); ret->hot.x=ret->width/2; ret->hot.y=ret->height/2; } else { @@ -346,7 +346,7 @@ draw_text(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { int bgcolor=0; - dbg(lvl_warning,"enter %s\n", text); + dbg(lvl_debug,"enter %s\n", text); initPaint(gra, fg); if(bg) bgcolor=(bg->a<<24)| (bg->r<<16) | (bg->g<<8) | bg->b; @@ -358,7 +358,7 @@ static void draw_image(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { - dbg(lvl_warning,"enter %p\n",img); + dbg(lvl_debug,"enter %p\n",img); initPaint(gra, fg); (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_image, fg->gra->Paint, p->x, p->y, img->Bitmap); @@ -467,7 +467,7 @@ static void resize_callback(struct graphics_priv *gra, int w, int h) { - dbg(lvl_error,"w=%d h=%d ok\n",w,h); + dbg(lvl_debug,"w=%d h=%d ok\n",w,h); callback_list_call_attr_2(gra->cbl, attr_resize, (void *)w, (void *)h); } @@ -483,7 +483,7 @@ static void keypress_callback(struct graphics_priv *gra, char *s) { - dbg(lvl_error,"enter %s\n",s); + dbg(lvl_debug,"enter %s\n",s); callback_list_call_attr_1(gra->cbl, attr_keypress, s); } @@ -504,20 +504,20 @@ jmethodID cid; ActivityClass = (*jnienv)->GetObjectClass(jnienv, android_activity); - dbg(lvl_error,"at 5\n"); + dbg(lvl_debug,"at 5\n"); if (ActivityClass == NULL) { - dbg(lvl_error,"no activity class found\n"); + dbg(lvl_debug,"no activity class found\n"); return 0; } - dbg(lvl_error,"at 6\n"); + dbg(lvl_debug,"at 6\n"); cid = (*jnienv)->GetMethodID(jnienv, ActivityClass, "setContentView", "(Landroid/view/View;)V"); if (cid == NULL) { dbg(lvl_error,"no setContentView method found\n"); return 0; } - dbg(lvl_error,"at 7\n"); + dbg(lvl_debug,"at 7\n"); (*jnienv)->CallVoidMethod(jnienv, android_activity, cid, graphics); - dbg(lvl_error,"at 8\n"); + dbg(lvl_debug,"at 8\n"); return 1; } @@ -527,7 +527,7 @@ struct callback *cb; jmethodID cid, Context_getPackageName; - dbg(lvl_error,"at 2 jnienv=%p\n",jnienv); + dbg(lvl_debug,"at 2 jnienv=%p\n",jnienv); if (!find_class_global("android/graphics/Paint", &ret->PaintClass)) return 0; if (!find_method(ret->PaintClass, "<init>", "(I)V", &ret->Paint_init)) @@ -572,15 +572,15 @@ if (!find_class_global("org/navitproject/navit/NavitGraphics", &ret->NavitGraphicsClass)) return 0; - dbg(lvl_error,"at 3\n"); + dbg(lvl_debug,"at 3\n"); cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "<init>", "(Landroid/app/Activity;Lorg/navitproject/navit/NavitGraphics;IIIIIII)V"); if (cid == NULL) { dbg(lvl_error,"no method found\n"); return 0; /* exception thrown */ } - dbg(lvl_error,"at 4 android_activity=%p\n",android_activity); + dbg(lvl_debug,"at 4 android_activity=%p\n",android_activity); ret->NavitGraphics=(*jnienv)->NewObject(jnienv, ret->NavitGraphicsClass, cid, android_activity, parent ? parent->NavitGraphics : NULL, pnt ? pnt->x:0 , pnt ? pnt->y:0, w, h, alpha, wraparound, use_camera); - dbg(lvl_error,"result=%p\n",ret->NavitGraphics); + dbg(lvl_debug,"result=%p\n",ret->NavitGraphics); if (ret->NavitGraphics) ret->NavitGraphics = (*jnienv)->NewGlobalRef(jnienv, ret->NavitGraphics); @@ -589,7 +589,7 @@ /* 0x101 = text kerning (default), antialiasing */ ret->Paint=(*jnienv)->NewObject(jnienv, ret->PaintClass, ret->Paint_init, 0x101); - dbg(lvl_error,"result=%p\n",ret->Paint); + dbg(lvl_debug,"result=%p\n",ret->Paint); if (ret->Paint) ret->Paint = (*jnienv)->NewGlobalRef(jnienv, ret->Paint); @@ -666,7 +666,7 @@ static void graphics_android_disable_suspend(struct window *win) { - dbg(lvl_warning,"enter\n"); + dbg(lvl_debug,"enter\n"); (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_disableSuspend); } @@ -691,7 +691,7 @@ } image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal); if (graphics_android_init(ret, NULL, NULL, 0, 0, 0, 0, use_camera)) { - dbg(lvl_error,"returning %p\n",ret); + dbg(lvl_debug,"returning %p\n",ret); return ret; } else { g_free(ret); @@ -705,7 +705,7 @@ struct graphics_priv *ret=g_new0(struct graphics_priv, 1); *meth=graphics_methods; if (graphics_android_init(ret, gr, p, w, h, alpha, wraparound, 0)) { - dbg(lvl_error,"returning %p\n",ret); + dbg(lvl_debug,"returning %p\n",ret); return ret; } else { g_free(ret); @@ -717,12 +717,12 @@ static void event_android_main_loop_run(void) { - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); } static void event_android_main_loop_quit(void) { - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_exit); } @@ -744,7 +744,7 @@ { struct pollfd pfd; pfd.fd=fd; - dbg(lvl_warning,"%p poll called for %d %d\n", fd, cond); + dbg(lvl_debug,"%p poll called for %d %d\n", fd, cond); switch ((enum event_watch_cond)cond) { case event_watch_cond_read: pfd.events=POLLIN; @@ -767,7 +767,7 @@ { jobject ret; ret=(*jnienv)->NewObject(jnienv, NavitWatchClass, NavitWatch_init, (int)do_poll, h, (int) cond, (int)cb); - dbg(lvl_error,"result for %d,%d,%p=%p\n",h,cond,cb,ret); + dbg(lvl_debug,"result for %d,%d,%p=%p\n",h,cond,cb,ret); if (ret) ret = (*jnienv)->NewGlobalRef(jnienv, ret); return (struct event_watch *)ret; @@ -776,7 +776,7 @@ static void event_android_remove_watch(struct event_watch *ev) { - dbg(lvl_error,"enter %p\n",ev); + dbg(lvl_debug,"enter %p\n",ev); if (ev) { jobject obj=(jobject )ev; (*jnienv)->CallVoidMethod(jnienv, obj, NavitWatch_remove); @@ -828,9 +828,9 @@ { #if 0 jobject ret; - dbg(lvl_warning,"enter\n"); + dbg(lvl_debug,"enter\n"); ret=(*jnienv)->NewObject(jnienv, NavitIdleClass, NavitIdle_init, (int)cb); - dbg(lvl_warning,"result for %p=%p\n",cb,ret); + dbg(lvl_debug,"result for %p=%p\n",cb,ret); if (ret) ret = (*jnienv)->NewGlobalRef(jnienv, ret); return (struct event_idle *)ret; @@ -842,7 +842,7 @@ event_android_remove_idle(struct event_idle *ev) { #if 0 - dbg(lvl_warning,"enter %p\n",ev); + dbg(lvl_debug,"enter %p\n",ev); if (ev) { jobject obj=(jobject )ev; (*jnienv)->CallVoidMethod(jnienv, obj, NavitIdle_remove); @@ -855,7 +855,7 @@ static void event_android_call_callback(struct callback_list *cb) { - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); } static struct event_methods event_android_methods = { @@ -873,7 +873,7 @@ static struct event_priv * event_android_new(struct event_methods *meth) { - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); if (!find_class_global("org/navitproject/navit/NavitTimeout", &NavitTimeoutClass)) return NULL; NavitTimeout_init = (*jnienv)->GetMethodID(jnienv, NavitTimeoutClass, "<init>", "(IZI)V"); @@ -913,7 +913,7 @@ Navit_fullscreen = (*jnienv)->GetMethodID(jnienv, NavitClass, "fullscreen", "(I)V"); if (Navit_fullscreen == NULL) return NULL; - dbg(lvl_error,"ok\n"); + dbg(lvl_debug,"ok\n"); *meth=event_android_methods; return NULL; } @@ -922,7 +922,7 @@ void plugin_init(void) { - dbg(lvl_error,"enter\n"); + dbg(lvl_debug,"enter\n"); plugin_register_graphics_type("android", graphics_android_new); plugin_register_event_type("android", event_android_new); } Modified: trunk/navit/navit/graphics/gd/graphics_gd.c =================================================================== --- trunk/navit/navit/graphics/gd/graphics_gd.c 2014-11-22 22:35:38 UTC (rev 5966) +++ trunk/navit/navit/graphics/gd/graphics_gd.c 2014-11-22 22:36:24 UTC (rev 5967) @@ -516,7 +516,7 @@ if (gr->flags & 2) { struct shmem_header *next=shm_next(gr); gr->shm_header->flag=1; - dbg(lvl_warning,"next flag is %d\n",next->flag); + dbg(lvl_debug,"next flag is %d\n",next->flag); if (!next->flag) { gr->shm_header=next; image_setup(gr); @@ -537,7 +537,7 @@ dbg(lvl_error,"connect failed\n"); } else { size_written=write(fd, data, size); - dbg(lvl_error,"size %d vs %d\n",size, size_written); + dbg(lvl_debug,"size %d vs %d\n",size, size_written); if (shutdown(fd, SHUT_RDWR) < 0) dbg(lvl_error,"shutdown failed\n"); } @@ -591,7 +591,7 @@ int b; struct point p; gdImagePtr im = this->im; - dbg(lvl_warning,"type=%s\n",type); + dbg(lvl_debug,"type=%s\n",type); if (!strcmp(type,"window")) return &this->window; if (!strcmp(type,"image_png")) { @@ -613,11 +613,11 @@ return &this->image; } if (sscanf(type,"click_%d_%d_%d",&p.x,&p.y,&b) == 3) { - dbg(lvl_warning,"click %d %d %d\n",p.x,p.y,b); + ... [truncated message content] |
From: <sl...@us...> - 2014-11-22 22:35:40
|
Revision: 5966 http://sourceforge.net/p/navit/code/5966 Author: sleske Date: 2014-11-22 22:35:38 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:core:Use appropriate logging prio on Android, don't log everything as ERROR.|#1269, part 5 Modified Paths: -------------- trunk/navit/navit/debug.c Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:35:22 UTC (rev 5965) +++ trunk/navit/navit/debug.c 2014-11-22 22:35:38 UTC (rev 5966) @@ -228,6 +228,26 @@ return "-invalid level-"; } +#ifdef HAVE_API_ANDROID +static android_LogPriority +dbg_level_to_android(dbg_level level) +{ + switch(level) { + case lvl_unset: + return ANDROID_LOG_UNKNOWN; + case lvl_error: + return ANDROID_LOG_ERROR; + case lvl_warning: + return ANDROID_LOG_WARN; + case lvl_info: + return ANDROID_LOG_INFO; + case lvl_debug: + return ANDROID_LOG_DEBUG; + } + return ANDROID_LOG_UNKNOWN; +} +#endif + void debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap) { @@ -236,7 +256,6 @@ #else char message_origin[mlen+flen+3]; #endif - FILE *fp=debug_fp; sprintf(message_origin, "%s:%s", module, function); if (global_debug_level >= level || debug_level_get(module) >= level || debug_level_get(message_origin) >= level) { @@ -262,7 +281,7 @@ MessageBoxW(NULL, muni, TEXT("Navit - Error"), MB_APPLMODAL|MB_OK|MB_ICONERROR); #else #ifdef HAVE_API_ANDROID - __android_log_print(ANDROID_LOG_ERROR,"navit", "%s", debug_message); + __android_log_print(dbg_level_to_android(level), "navit", "%s", debug_message); #else #ifdef HAVE_SOCKET if (debug_socket != -1) { @@ -270,6 +289,7 @@ return; } #endif + FILE *fp=debug_fp; if (! fp) fp = stderr; fprintf(fp,"%s",debug_message); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:35:29
|
Revision: 5965 http://sourceforge.net/p/navit/code/5965 Author: sleske Date: 2014-11-22 22:35:22 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:core:Mention debug level names in help for -d.|#1269, part 4 Modified Paths: -------------- trunk/navit/navit/start_real.c Modified: trunk/navit/navit/start_real.c =================================================================== --- trunk/navit/navit/start_real.c 2014-11-22 22:35:11 UTC (rev 5964) +++ trunk/navit/navit/start_real.c 2014-11-22 22:35:22 UTC (rev 5965) @@ -60,10 +60,11 @@ { printf("%s",_("navit usage:\n" "navit [options] [configfile]\n" - "\t-c <file>: use <file> as config file\n" - "\t-d <n>: set the global debug output level to <n> (0-3). Overrides setting from config file.\n" + "\t-c <file>: use <file> as config file, instead of using the default file.\n" + "\t-d <n>: set the global debug output level to <n> (0=error, 1=warning, 2=info, 3=debug).\n" + "\tSettings from config file will still take effect where they set a higher level.\n" "\t-h: print this usage info and exit.\n" - "\t-v: Print the version and exit.\n")); + "\t-v: print the version and exit.\n")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:35:15
|
Revision: 5964 http://sourceforge.net/p/navit/code/5964 Author: sleske Date: 2014-11-22 22:35:11 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Refactor:core:Introduce #define DEFAULT_DEBUG_LEVEL|#1269, part 3 Modified Paths: -------------- trunk/navit/navit/debug.c trunk/navit/navit/debug.h Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:35:03 UTC (rev 5963) +++ trunk/navit/navit/debug.c 2014-11-22 22:35:11 UTC (rev 5964) @@ -52,7 +52,8 @@ #endif -dbg_level debug_level=lvl_error; +#define DEFAULT_DEBUG_LEVEL lvl_error +dbg_level max_debug_level=DEFAULT_DEBUG_LEVEL; #define GLOBAL_DEBUG_LEVEL_UNSET lvl_unset dbg_level global_debug_level=GLOBAL_DEBUG_LEVEL_UNSET; int segv_level=0; @@ -101,16 +102,16 @@ static void debug_update_level(gpointer key, gpointer value, gpointer user_data) { - if (debug_level < GPOINTER_TO_INT(value)) - debug_level = GPOINTER_TO_INT(value); + if (max_debug_level < GPOINTER_TO_INT(value)) + max_debug_level = GPOINTER_TO_INT(value); } void debug_set_global_level(dbg_level level, int override_old_value ) { if (global_debug_level == GLOBAL_DEBUG_LEVEL_UNSET || override_old_value) { global_debug_level=level; - if (debug_level < global_debug_level){ - debug_level = global_debug_level; + if (max_debug_level < global_debug_level){ + max_debug_level = global_debug_level; } } } @@ -176,8 +177,12 @@ debug_level_get(const char *message_category) { if (!debug_hash) - return lvl_error; - return GPOINTER_TO_INT(g_hash_table_lookup(debug_hash, message_category)); + return DEFAULT_DEBUG_LEVEL; + gpointer level = g_hash_table_lookup(debug_hash, message_category); + if (!level) { + return DEFAULT_DEBUG_LEVEL; + } + return GPOINTER_TO_INT(level); } static void debug_timestamp(char *buffer) Modified: trunk/navit/navit/debug.h =================================================================== --- trunk/navit/navit/debug.h 2014-11-22 22:35:03 UTC (rev 5963) +++ trunk/navit/navit/debug.h 2014-11-22 22:35:11 UTC (rev 5964) @@ -52,11 +52,11 @@ lvl_debug } dbg_level; -extern dbg_level debug_level; +extern dbg_level max_debug_level; #define dbg_str2(x) #x #define dbg_str1(x) dbg_str2(x) #define dbg_module dbg_str1(MODULE) -#define dbg(level,...) { if (debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,__VA_ARGS__); } +#define dbg(level,...) { if (max_debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,__VA_ARGS__); } #define dbg_assert(expr) ((expr) ? (void) 0 : debug_assert_fail(dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),__FILE__,__LINE__,dbg_str1(expr))) #define DEBUG_MODULE_GLOBAL "global" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:35:06
|
Revision: 5963 http://sourceforge.net/p/navit/code/5963 Author: sleske Date: 2014-11-22 22:35:03 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:core:Simplify and fix profiling code, always print times with precision 0.1. Modified Paths: -------------- trunk/navit/navit/profile.c Modified: trunk/navit/navit/profile.c =================================================================== --- trunk/navit/navit/profile.c 2014-11-22 22:34:45 UTC (rev 5962) +++ trunk/navit/navit/profile.c 2014-11-22 22:35:03 UTC (rev 5963) @@ -27,40 +27,37 @@ #include "profile.h" #include "debug.h" +#define PROFILE_LEVEL_MAX 9 + void profile_timer(int level, const char *module, const char *function, const char *fmt, ...) { #ifndef _MSC_VER va_list ap; - static struct timeval last[10]; + static struct timeval last[PROFILE_LEVEL_MAX+1]; struct timeval curr; - int msec,usec; + double msec; char buffer[strlen(module)+20]; - va_start(ap, fmt); if (level < 0) level=0; - if (level > 9) - level=9; + if (level > PROFILE_LEVEL_MAX) + level=PROFILE_LEVEL_MAX; if (fmt) { gettimeofday(&curr, NULL); - msec=(curr.tv_usec-last[level].tv_usec)/1000+ + msec=(curr.tv_usec-last[level].tv_usec)/((double)1000)+ (curr.tv_sec-last[level].tv_sec)*1000; sprintf(buffer, "profile:%s", module); + va_start(ap, fmt); debug_vprintf(1, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap); - if (msec >= 100) - debug_printf(lvl_warning, buffer, strlen(buffer), function, strlen(function), 0, " %d msec\n", msec); - else { - usec=(curr.tv_usec-last[level].tv_usec)+(curr.tv_sec-last[level].tv_sec)*1000*1000; - debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d.%d msec\n", usec/1000, usec%1000); - } + va_end(ap); + debug_printf(lvl_warning, buffer, strlen(buffer), function, strlen(function), 0, " %7.1f ms\n", msec); gettimeofday(&last[level], NULL); } else { gettimeofday(&curr, NULL); - while (level < 10) + while (level <= PROFILE_LEVEL_MAX) last[level++]=curr; } - va_end(ap); #endif /*_MSC_VER*/ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:34:54
|
Revision: 5962 http://sourceforge.net/p/navit/code/5962 Author: sleske Date: 2014-11-22 22:34:45 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Fix:maptool:Fix typos in messages and comment. Modified Paths: -------------- trunk/navit/navit/maptool/maptool.c trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/maptool.c =================================================================== --- trunk/navit/navit/maptool/maptool.c 2014-11-22 22:34:36 UTC (rev 5961) +++ trunk/navit/navit/maptool/maptool.c 2014-11-22 22:34:45 UTC (rev 5962) @@ -917,7 +917,7 @@ if (start_phase(&p,"generating coastlines")) { osm_process_coastlines(&p, suffix); } - if (start_phase(&p,"assinging towns to countries")) { + if (start_phase(&p,"assigning towns to countries")) { FILE *towns=tempfile(suffix,"towns",0),*boundaries=NULL,*ways=NULL; if (towns) { boundaries=tempfile(suffix,"boundaries",0); Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-11-22 22:34:36 UTC (rev 5961) +++ trunk/navit/navit/maptool/osm.c 2014-11-22 22:34:45 UTC (rev 5962) @@ -2030,7 +2030,7 @@ profile(0,NULL); bl=process_boundaries(boundaries, ways); - profile(1,"processed boundraries\n"); + profile(1,"processed boundaries\n"); town_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); while ((ib=read_item(in))) { @@ -2057,7 +2057,7 @@ else if (item_is_district(*ib)) // just for the town name osm_process_town_by_is_in(ib, is_in, attrs, town_hash); - // treat a district like a town, if we could not find the town it blongs to + // treat a district like a town, if we could not find the town it belongs to if (!item_bin_get_attr(ib, attr_town_name, NULL) && attrs[10].type != attr_town_name) { char *district_name = item_bin_get_attr(ib, attr_district_name, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:34:38
|
Revision: 5961 http://sourceforge.net/p/navit/code/5961 Author: sleske Date: 2014-11-22 22:34:36 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Add:core:Output severity/level of debug message.|#1269, part 2 Modified Paths: -------------- trunk/navit/navit/debug.c Modified: trunk/navit/navit/debug.c =================================================================== --- trunk/navit/navit/debug.c 2014-11-22 22:34:19 UTC (rev 5960) +++ trunk/navit/navit/debug.c 2014-11-22 22:34:36 UTC (rev 5961) @@ -173,11 +173,11 @@ dbg_level -debug_level_get(const char *name) +debug_level_get(const char *message_category) { if (!debug_hash) return lvl_error; - return GPOINTER_TO_INT(g_hash_table_lookup(debug_hash, name)); + return GPOINTER_TO_INT(g_hash_table_lookup(debug_hash, message_category)); } static void debug_timestamp(char *buffer) @@ -206,49 +206,68 @@ #endif } +static char* dbg_level_to_string(dbg_level level) +{ + switch(level) { + case lvl_unset: + return "-unset-"; + case lvl_error: + return "error"; + case lvl_warning: + return "warning"; + case lvl_info: + return "info"; + case lvl_debug: + return "debug"; + } + return "-invalid level-"; +} + void debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap) { #if defined HAVE_API_WIN32_CE || defined _MSC_VER - char buffer[4096]; + char debug_headers[4096]; #else - char buffer[mlen+flen+3]; + char message_origin[mlen+flen+3]; #endif FILE *fp=debug_fp; - sprintf(buffer, "%s:%s", module, function); - if (global_debug_level >= level || debug_level_get(module) >= level || debug_level_get(buffer) >= level) { + sprintf(message_origin, "%s:%s", module, function); + if (global_debug_level >= level || debug_level_get(module) >= level || debug_level_get(message_origin) >= level) { #if defined(DEBUG_WIN32_CE_MESSAGEBOX) wchar_t muni[4096]; #endif - char xbuffer[4096]; - xbuffer[0]='\0'; + char debug_message[4096]; + debug_message[0]='\0'; if (prefix) { if (timestamp_prefix) - debug_timestamp(xbuffer); - strcpy(xbuffer+strlen(xbuffer),buffer); - strcpy(xbuffer+strlen(xbuffer),":"); + debug_timestamp(debug_message); + strcpy(debug_message+strlen(debug_message),dbg_level_to_string(level)); + strcpy(debug_message+strlen(debug_message),":"); + strcpy(debug_message+strlen(debug_message),message_origin); + strcpy(debug_message+strlen(debug_message),":"); } #if defined HAVE_API_WIN32_CE #define vsnprintf _vsnprintf #endif - vsnprintf(xbuffer+strlen(xbuffer),4095-strlen(xbuffer),fmt,ap); + vsnprintf(debug_message+strlen(debug_message),4095-strlen(debug_message),fmt,ap); #ifdef DEBUG_WIN32_CE_MESSAGEBOX - mbstowcs(muni, xbuffer, strlen(xbuffer)+1); + mbstowcs(muni, debug_message, strlen(debug_message)+1); MessageBoxW(NULL, muni, TEXT("Navit - Error"), MB_APPLMODAL|MB_OK|MB_ICONERROR); #else #ifdef HAVE_API_ANDROID - __android_log_print(ANDROID_LOG_ERROR,"navit", "%s", xbuffer); + __android_log_print(ANDROID_LOG_ERROR,"navit", "%s", debug_message); #else #ifdef HAVE_SOCKET if (debug_socket != -1) { - sendto(debug_socket, xbuffer, strlen(xbuffer), 0, (struct sockaddr *)&debug_sin, sizeof(debug_sin)); + sendto(debug_socket, debug_message, strlen(debug_message), 0, (struct sockaddr *)&debug_sin, sizeof(debug_sin)); return; } #endif if (! fp) fp = stderr; - fprintf(fp,"%s",xbuffer); + fprintf(fp,"%s",debug_message); fflush(fp); #endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-11-22 22:34:26
|
Revision: 5960 http://sourceforge.net/p/navit/code/5960 Author: sleske Date: 2014-11-22 22:34:19 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269. Modified Paths: -------------- trunk/navit/navit/android.c trunk/navit/navit/attr.c trunk/navit/navit/autoload/osso/osso.c trunk/navit/navit/binding/dbus/binding_dbus.c trunk/navit/navit/binding/python/config.c trunk/navit/navit/binding/python/navit.c trunk/navit/navit/binding/python/pcoord.c trunk/navit/navit/binding/win32/binding_win32.c trunk/navit/navit/bookmarks.c trunk/navit/navit/cache.c trunk/navit/navit/callback.c trunk/navit/navit/command.c trunk/navit/navit/config_.c trunk/navit/navit/coord.c trunk/navit/navit/debug.c trunk/navit/navit/debug.h trunk/navit/navit/event.c trunk/navit/navit/file.c trunk/navit/navit/font/freetype/font_freetype.c trunk/navit/navit/graphics/android/graphics_android.c trunk/navit/navit/graphics/gd/graphics_gd.c trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c trunk/navit/navit/graphics/null/graphics_null.c trunk/navit/navit/graphics/opengl/graphics_opengl.c trunk/navit/navit/graphics/opengl/graphics_opengl_egl.c trunk/navit/navit/graphics/opengl/graphics_opengl_x11.c trunk/navit/navit/graphics/qt_qpainter/RenderArea.cpp trunk/navit/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp trunk/navit/navit/graphics/sdl/event.c trunk/navit/navit/graphics/sdl/event_sdl.c trunk/navit/navit/graphics/sdl/graphics_sdl.c trunk/navit/navit/graphics/win32/graphics_win32.c trunk/navit/navit/graphics.c trunk/navit/navit/gui/gtk/datawindow.c trunk/navit/navit/gui/gtk/destination.c trunk/navit/navit/gui/gtk/gui_gtk_action.c trunk/navit/navit/gui/gtk/gui_gtk_poi.c trunk/navit/navit/gui/gtk/gui_gtk_window.c trunk/navit/navit/gui/internal/gui_internal.c trunk/navit/navit/gui/internal/gui_internal_bookmark.c trunk/navit/navit/gui/internal/gui_internal_command.c trunk/navit/navit/gui/internal/gui_internal_gesture.c trunk/navit/navit/gui/internal/gui_internal_html.c trunk/navit/navit/gui/internal/gui_internal_menu.c trunk/navit/navit/gui/internal/gui_internal_poi.c trunk/navit/navit/gui/internal/gui_internal_search.c trunk/navit/navit/gui/internal/gui_internal_widget.c trunk/navit/navit/gui/qml/bookmarksProxy.h trunk/navit/navit/gui/qml/gui_qml.cpp trunk/navit/navit/gui/qml/navitProxy.h trunk/navit/navit/gui/qml/ngqpoint.h trunk/navit/navit/gui/qml/proxy.h trunk/navit/navit/gui/qml/routeProxy.h trunk/navit/navit/gui/qml/searchProxy.h trunk/navit/navit/gui/win32/gui_win32.c trunk/navit/navit/gui/win32/win32_gui_destination.c trunk/navit/navit/gui.c trunk/navit/navit/item.c trunk/navit/navit/layout.c trunk/navit/navit/linguistics.c trunk/navit/navit/log.c trunk/navit/navit/main.c trunk/navit/navit/map/binfile/binfile.c trunk/navit/navit/map/csv/csv.c trunk/navit/navit/map/csv/quadtree.c trunk/navit/navit/map/filter/filter.c trunk/navit/navit/map/mg/block.c trunk/navit/navit/map/mg/map.c trunk/navit/navit/map/mg/poly.c trunk/navit/navit/map/mg/street.c trunk/navit/navit/map/mg/town.c trunk/navit/navit/map/mg/tree.c trunk/navit/navit/map/shapefile/shapefile.c trunk/navit/navit/map/textfile/textfile.c trunk/navit/navit/map.c trunk/navit/navit/maps.c trunk/navit/navit/mapset.c trunk/navit/navit/maptool/ch.c trunk/navit/navit/maptool/coastline.c trunk/navit/navit/navigation.c trunk/navit/navit/navit.c trunk/navit/navit/osd/core/osd_core.c trunk/navit/navit/osd.c trunk/navit/navit/plugin/pedestrian/pedestrian.c trunk/navit/navit/plugin.c trunk/navit/navit/popup.c trunk/navit/navit/profile.c trunk/navit/navit/profile_option.c trunk/navit/navit/projection.c trunk/navit/navit/route.c trunk/navit/navit/routech.c trunk/navit/navit/script.c trunk/navit/navit/search.c trunk/navit/navit/search_houseno_interpol.c trunk/navit/navit/speech/android/speech_android.c trunk/navit/navit/speech/cmdline/speech_cmdline.c trunk/navit/navit/speech/espeak/speak.c trunk/navit/navit/speech.c trunk/navit/navit/start_real.c trunk/navit/navit/support/libc/stat.c trunk/navit/navit/support/win32/serial_io.c trunk/navit/navit/support/wordexp/glob.c trunk/navit/navit/track.c trunk/navit/navit/transform.c trunk/navit/navit/util.c trunk/navit/navit/vehicle/android/vehicle_android.c trunk/navit/navit/vehicle/demo/vehicle_demo.c trunk/navit/navit/vehicle/file/vehicle_file.c trunk/navit/navit/vehicle/gpsd/vehicle_gpsd.c trunk/navit/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c trunk/navit/navit/vehicle/gypsy/vehicle_gypsy.c trunk/navit/navit/vehicle/iphone/vehicle_iphone.c trunk/navit/navit/vehicle/maemo/vehicle_maemo.c trunk/navit/navit/vehicle/null/vehicle_null.c trunk/navit/navit/vehicle/webos/bluetooth.c trunk/navit/navit/vehicle/webos/vehicle_webos.c trunk/navit/navit/vehicle/wince/vehicle_wince.c trunk/navit/navit/vehicle.c trunk/navit/navit/vehicleprofile.c trunk/navit/navit/xmlconfig.c Modified: trunk/navit/navit/android.c =================================================================== --- trunk/navit/navit/android.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/android.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -43,7 +43,7 @@ { *ret=(*jnienv)->FindClass(jnienv, name); if (! *ret) { - dbg(0,"Failed to get Class %s\n",name); + dbg(lvl_error,"Failed to get Class %s\n",name); return 0; } *ret = (*jnienv)->NewGlobalRef(jnienv, *ret); @@ -55,7 +55,7 @@ { *ret = (*jnienv)->GetMethodID(jnienv, class, name, args); if (*ret == NULL) { - dbg(0,"Failed to get Method %s with signature %s\n",name,args); + dbg(lvl_error,"Failed to get Method %s with signature %s\n",name,args); return 0; } return 1; @@ -67,7 +67,7 @@ { *ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args); if (*ret == NULL) { - dbg(0,"Failed to get static Method %s with signature %s\n",name,args); + dbg(lvl_error,"Failed to get static Method %s with signature %s\n",name,args); return 0; } return 1; @@ -83,12 +83,12 @@ jnienv=env; android_activity = (*jnienv)->NewGlobalRef(jnienv, activity); langstr=(*env)->GetStringUTFChars(env, lang, NULL); - dbg(0,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,android_activity,langstr,version); + dbg(lvl_error,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,android_activity,langstr,version); setenv("LANG",langstr,1); (*env)->ReleaseStringUTFChars(env, lang, langstr); displaydensitystr=(*env)->GetStringUTFChars(env, display_density_string, NULL); - dbg(0,"*****displaydensity=%s\n",displaydensitystr); + dbg(lvl_error,"*****displaydensity=%s\n",displaydensitystr); setenv("ANDROID_DENSITY",displaydensitystr,1); (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr); const char *strings=(*env)->GetStringUTFChars(env, path, NULL); @@ -99,14 +99,14 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_Navit_NavitDestroy( JNIEnv* env) { - dbg(0, "shutdown navit\n"); + dbg(lvl_error, "shutdown navit\n"); exit(0); } JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobject thiz, int id, int w, int h) { - dbg(0,"enter %p %d %d\n",(struct callback *)id,w,h); + dbg(lvl_error,"enter %p %d %d\n",(struct callback *)id,w,h); if (id) callback_call_2((struct callback *)id,w,h); } @@ -114,7 +114,7 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_ButtonCallback( JNIEnv* env, jobject thiz, int id, int pressed, int button, int x, int y) { - dbg(1,"enter %p %d %d\n",(struct callback *)id,pressed,button); + dbg(lvl_warning,"enter %p %d %d\n",(struct callback *)id,pressed,button); if (id) callback_call_4((struct callback *)id,pressed,button,x,y); } @@ -122,7 +122,7 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_MotionCallback( JNIEnv* env, jobject thiz, int id, int x, int y) { - dbg(1,"enter %p %d %d\n",(struct callback *)id,x,y); + dbg(lvl_warning,"enter %p %d %d\n",(struct callback *)id,x,y); if (id) callback_call_2((struct callback *)id,x,y); } @@ -131,9 +131,9 @@ Java_org_navitproject_navit_NavitGraphics_KeypressCallback( JNIEnv* env, jobject thiz, int id, jobject str) { const char *s; - dbg(0,"enter %p %p\n",(struct callback *)id,str); + dbg(lvl_error,"enter %p %p\n",(struct callback *)id,str); s=(*env)->GetStringUTFChars(env, str, NULL); - dbg(0,"key=%d",s); + dbg(lvl_error,"key=%d",s); if (id) callback_call_1((struct callback *)id,s); (*env)->ReleaseStringUTFChars(env, str, s); @@ -143,7 +143,7 @@ Java_org_navitproject_navit_NavitTimeout_TimeoutCallback( JNIEnv* env, jobject thiz, int id) { void (*event_handler)(void *) = *(void **)id; - dbg(1,"enter %p %p\n",thiz, (void *)id); + dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id); event_handler((void*)id); } @@ -156,7 +156,7 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitIdle_IdleCallback( JNIEnv* env, jobject thiz, int id) { - dbg(1,"enter %p %p\n",thiz, (void *)id); + dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id); callback_call_0((struct callback *)id); } @@ -171,14 +171,14 @@ JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitWatch_WatchCallback( JNIEnv* env, jobject thiz, int id) { - dbg(1,"enter %p %p\n",thiz, (void *)id); + dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id); callback_call_0((struct callback *)id); } JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitSensors_SensorCallback( JNIEnv* env, jobject thiz, int id, int sensor, float x, float y, float z) { - dbg(1,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z); + dbg(lvl_warning,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z); callback_call_4((struct callback *)id, sensor, &x, &y, &z); } @@ -208,10 +208,10 @@ const char *localized_str; s=(*env)->GetStringUTFChars(env, str, NULL); - //dbg(0,"*****string=%s\n",s); + //dbg(lvl_error,"*****string=%s\n",s); localized_str=navit_nls_gettext(s); - //dbg(0,"localized string=%s",localized_str); + //dbg(lvl_error,"localized string=%s",localized_str); // jstring dataStringValue = (jstring) localized_str; jstring js = (*env)->NewStringUTF(env,localized_str); @@ -227,7 +227,7 @@ struct attr attr; const char *s; jint ret = 0; - dbg(0,"enter %d %p\n",channel,str); + dbg(lvl_error,"enter %d %p\n",channel,str); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -248,7 +248,7 @@ struct mapset *ms = navit_get_mapset(attr.u.navit); struct attr type, name, data, *attrs[4]; const char *map_location=(*env)->GetStringUTFChars(env, str, NULL); - dbg(0,"*****string=%s\n",map_location); + dbg(lvl_error,"*****string=%s\n",map_location); type.type=attr_type; type.u.str="binfile"; @@ -280,7 +280,7 @@ if (delete_map) { - dbg(0,"delete map %s (%p)", map_location, delete_map); + dbg(lvl_error,"delete map %s (%p)", map_location, delete_map); map_r.type=attr_map; map_r.u.map=delete_map; ret = mapset_remove_attr(ms, &map_r); @@ -292,7 +292,7 @@ case 5: // call a command (like in gui) s=(*env)->GetStringUTFChars(env, str, NULL); - dbg(0,"*****string=%s\n",s); + dbg(lvl_error,"*****string=%s\n",s); command_evaluate(&attr,s); (*env)->ReleaseStringUTFChars(env, str, s); break; @@ -310,7 +310,7 @@ char parse_str[strlen(s) + 1]; strcpy(parse_str, s); (*env)->ReleaseStringUTFChars(env, str, s); - dbg(0,"*****string=%s\n",parse_str); + dbg(lvl_error,"*****string=%s\n",parse_str); // set destination to (pixel-x#pixel-y) // pixel-x @@ -320,8 +320,8 @@ pstr = strtok (NULL, "#"); p.y = atoi(pstr); - dbg(0,"11x=%d\n",p.x); - dbg(0,"11y=%d\n",p.y); + dbg(lvl_error,"11x=%d\n",p.x); + dbg(lvl_error,"11y=%d\n",p.y); transform_reverse(transform, &p, &c); @@ -330,8 +330,8 @@ pc.y = c.y; pc.pro = transform_get_projection(transform); - dbg(0,"22x=%d\n",pc.x); - dbg(0,"22y=%d\n",pc.y); + dbg(lvl_error,"22x=%d\n",pc.x); + dbg(lvl_error,"22y=%d\n",pc.y); // start navigation asynchronous navit_set_destination(attr.u.navit, &pc, parse_str, 1); @@ -345,7 +345,7 @@ char parse_str[strlen(s) + 1]; strcpy(parse_str, s); (*env)->ReleaseStringUTFChars(env, str, s); - dbg(0,"*****string=%s\n",s); + dbg(lvl_error,"*****string=%s\n",s); // set destination to (lat#lon#title) struct coord_geo g; @@ -361,9 +361,9 @@ // description name = strtok (NULL, "#"); - dbg(0,"lat=%f\n",g.lat); - dbg(0,"lng=%f\n",g.lng); - dbg(0,"str1=%s\n",name); + dbg(lvl_error,"lat=%f\n",g.lat); + dbg(lvl_error,"lng=%f\n",g.lng); + dbg(lvl_error,"str1=%s\n",name); struct coord c; transform_from_geo(projection_mg, &g, &c); @@ -379,7 +379,7 @@ } break; default: - dbg(0, "Unknown command"); + dbg(lvl_error, "Unknown command"); } return ret; @@ -394,7 +394,7 @@ jstring return_string = NULL; struct attr attr; - dbg(0,"enter %d %p\n",channel,str); + dbg(lvl_error,"enter %d %p\n",channel,str); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -409,12 +409,12 @@ struct mapset *ms=navit_get_mapset(attr.u.navit); struct search_list *search_list = search_list_new(ms); search_attr.type=attr_country_all; - dbg(0,"country %s\n", country_name.u.str); + dbg(lvl_error,"country %s\n", country_name.u.str); search_attr.u.str=country_name.u.str; search_list_search(search_list, &search_attr, 0); while((res=search_list_get_result(search_list))) { - dbg(0,"Get result: %s\n", res->country->iso2); + dbg(lvl_error,"Get result: %s\n", res->country->iso2); } if (item_attr_get(item, attr_country_iso2, &country_iso2)) return_string = (*env)->NewStringUTF(env,country_iso2.u.str); @@ -435,7 +435,7 @@ jobjectArray all_countries; struct attr attr; - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -443,12 +443,12 @@ struct search_list *search_list = search_list_new(ms); jobjectArray current_country = NULL; search_attr.type=attr_country_all; - //dbg(0,"country %s\n", country_name.u.str); + //dbg(lvl_error,"country %s\n", country_name.u.str); search_attr.u.str=g_strdup("");//country_name.u.str; search_list_search(search_list, &search_attr, 1); while((res=search_list_get_result(search_list))) { - dbg(0,"Get result: %s\n", res->country->iso2); + dbg(lvl_error,"Get result: %s\n", res->country->iso2); if (strlen(res->country->iso2)==2) { @@ -543,7 +543,7 @@ static void android_search_end(struct android_search_priv *search_priv) { - dbg(1, "End search"); + dbg(lvl_warning, "End search"); JNIEnv* env = search_priv->search_result_obj.env; if (search_priv->idle_ev) { event_remove_idle(search_priv->idle_ev); @@ -558,7 +558,7 @@ if(finish_MethodID != 0) { (*env)->CallVoidMethod(env, search_priv->search_result_obj.jo, finish_MethodID); } else { - dbg(0, "Error method finishAddressSearch not found"); + dbg(lvl_error, "Error method finishAddressSearch not found"); } search_list_destroy(search_priv->search_list); @@ -575,11 +575,11 @@ static void android_search_idle(struct android_search_priv *search_priv) { - dbg(1, "enter android_search_idle"); + dbg(lvl_warning, "enter android_search_idle"); struct search_list_result *res = search_list_get_result(search_priv->search_list); if (res) { - dbg(1, "Town: %s, Street: %s\n",res->town ? res->town->common.town_name : "no town", res->street ? res->street->name : "no street"); + dbg(lvl_warning, "Town: %s, Street: %s\n",res->town ? res->town->common.town_name : "no town", res->street ? res->street->name : "no street"); search_priv->found = 1; switch (search_priv->search_attr.type) { @@ -609,7 +609,7 @@ break; } default: - dbg(0, "Unhandled search type %d", search_priv->search_attr.type); + dbg(lvl_error, "Unhandled search type %d", search_priv->search_attr.type); } } else { int level = search_list_level(search_priv->search_attr.type) - 1; @@ -620,10 +620,10 @@ level++; } } - dbg(2, "test phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level) + dbg(lvl_info, "test phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level) do { while (!search_priv->phrases[++search_priv->current_phrase_per_level[level]]) { - dbg(2, "next phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level) + dbg(lvl_info, "next phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level) if (level > 0) { search_priv->current_phrase_per_level[level] = -1; level--; @@ -633,8 +633,8 @@ } } } while (level > 0 ? search_priv->current_phrase_per_level[level] == search_priv->current_phrase_per_level[level-1] : 0); - dbg(2, "used phrase: %d,%d, %d, level %d, '%s'", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level, attr_to_name(android_search_level[level])) - dbg(1, "Search for '%s'", search_priv->phrases[search_priv->current_phrase_per_level[level]]); + dbg(lvl_info, "used phrase: %d,%d, %d, level %d, '%s'", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level, attr_to_name(android_search_level[level])) + dbg(lvl_warning, "Search for '%s'", search_priv->phrases[search_priv->current_phrase_per_level[level]]); search_priv->search_attr.type = android_search_level[level]; search_priv->search_attr.u.str = search_priv->phrases[search_priv->current_phrase_per_level[level]]; struct attr test; @@ -642,7 +642,7 @@ test.u.str = search_priv->phrases[search_priv->current_phrase_per_level[level]]; search_list_search(search_priv->search_list, &test, search_priv->partial); } - dbg(2, "leave"); + dbg(lvl_info, "leave"); } static char * @@ -677,12 +677,12 @@ static void start_search(struct android_search_priv *search_priv, const char *search_string) { - dbg(1,"enter %s\n", search_string); + dbg(lvl_warning,"enter %s\n", search_string); char *str=search_fix_spaces(search_string); search_priv->phrases = g_strsplit(str, " ", 0); //ret=search_address_town(ret, sl, phrases, NULL, partial, jni); - dbg(1,"First search phrase %s", search_priv->phrases[0]); + dbg(lvl_warning,"First search phrase %s", search_priv->phrases[0]); search_priv->search_attr.u.str= search_priv->phrases[0]; search_priv->search_attr.type=attr_town_or_district_name; search_list_search(search_priv->search_list, &search_priv->search_attr, search_priv->partial); @@ -692,7 +692,7 @@ //callback_call_0(search_priv->idle_clb); g_free(str); - dbg(1,"leave\n"); + dbg(lvl_warning,"leave\n"); } JNIEXPORT jlong JNICALL @@ -700,7 +700,7 @@ { struct attr attr; const char *search_string =(*env)->GetStringUTFChars(env, str, NULL); - dbg(0,"search '%s'\n", search_string); + dbg(lvl_error,"search '%s'\n", search_string); config_get_attr(config_get(), attr_navit, &attr, NULL); @@ -731,9 +731,9 @@ count++; } if (!count) - dbg(0,"Country not found"); + dbg(lvl_error,"Country not found"); - dbg(1,"search in country '%s'\n", str_country); + dbg(lvl_warning,"search in country '%s'\n", str_country); (*env)->ReleaseStringUTFChars(env, country, str_country); search_priv->search_result_obj.env = env; @@ -743,7 +743,7 @@ start_search(search_priv, search_string); } else - dbg(0,"**** Unable to get methodID: fillStringArray"); + dbg(lvl_error,"**** Unable to get methodID: fillStringArray"); (*env)->ReleaseStringUTFChars(env, str, search_string); @@ -758,5 +758,5 @@ if (priv) android_search_end(priv); else - dbg(0, "Error: Cancel search failed"); + dbg(lvl_error, "Error: Cancel search failed"); } Modified: trunk/navit/navit/attr.c =================================================================== --- trunk/navit/navit/attr.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/attr.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -152,7 +152,7 @@ int min,max,count; ret=g_new0(struct attr, 1); - dbg(3,"enter name='%s' value='%s'\n", name, value); + dbg(lvl_debug,"enter name='%s' value='%s'\n", name, value); attr=attr_from_name(name); ret->type=attr; switch (attr) { @@ -170,7 +170,7 @@ ret->u.item_types[count++]=item_type; ret->u.item_types[count]=type_none; } else { - dbg(0,"Unknown item type '%s' ignored.\n",tok); + dbg(lvl_error,"Unknown item type '%s' ignored.\n",tok); } str=NULL; } @@ -233,13 +233,13 @@ Relative values are from 0x40000001 - 0x80000000, with 0x60000000 being 0 */ if (strchr(value, '%')) { if ((ret->u.num > 0x20000000) || (ret->u.num < -0x1FFFFFFF)) { - dbg(0, "Relative possibly-relative attribute with invalid value %li\n", ret->u.num); + dbg(lvl_error, "Relative possibly-relative attribute with invalid value %li\n", ret->u.num); } ret->u.num += 0x60000000; } else { if ((ret->u.num > 0x40000000) || (ret->u.num < -0x40000000)) { - dbg(0, "Non-relative possibly-relative attribute with invalid value %li\n", ret->u.num); + dbg(lvl_error, "Non-relative possibly-relative attribute with invalid value %li\n", ret->u.num); } } } else if (attr >= attr_type_boolean_begin) { // also check for yes and no @@ -267,7 +267,7 @@ color->b = (b << 8) | b; color->a = (a << 8) | a; } else { - dbg(0,"color %s has unknown format\n",value); + dbg(lvl_error,"color %s has unknown format\n",value); } break; } @@ -278,7 +278,7 @@ transform_to_geo(projection_mg, &c, g); break; } - dbg(1,"default\n"); + dbg(lvl_warning,"default\n"); g_free(ret); ret=NULL; } @@ -485,9 +485,9 @@ struct attr * attr_search(struct attr **attrs, struct attr *last, enum attr_type attr) { - dbg(2, "enter attrs=%p\n", attrs); + dbg(lvl_info, "enter attrs=%p\n", attrs); while (*attrs) { - dbg(3,"*attrs=%p\n", *attrs); + dbg(lvl_debug,"*attrs=%p\n", *attrs); if ((*attrs)->type == attr) { return *attrs; } @@ -750,7 +750,7 @@ while (attr->u.attr_types[i++] != attr_none); return i*sizeof(enum attr_type); } - dbg(0,"size for %s unknown\n", attr_to_name(attr->type)); + dbg(lvl_error,"size for %s unknown\n", attr_to_name(attr->type)); return 0; } @@ -887,7 +887,7 @@ int len=0,quoted; char *p,*e,*n; - dbg(1,"get_tag %s from %s\n", name, line); + dbg(lvl_warning,"get_tag %s from %s\n", name, line); if (name) len=strlen(name); if (pos) Modified: trunk/navit/navit/autoload/osso/osso.c =================================================================== --- trunk/navit/navit/autoload/osso/osso.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/autoload/osso/osso.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -24,7 +24,7 @@ { osso_return_t err; err = osso_display_blanking_pause(osso_context); - dbg(1, "Unblank result: ", + dbg(lvl_warning, "Unblank result: ", err == OSSO_OK ? "Ok" : (err == OSSO_ERROR ? "Error" : "Invalid context")); @@ -33,7 +33,7 @@ static gboolean osso_cb_hw_state_idle(struct cb_hw_state_trail * params) { - dbg(0, "(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n", + dbg(lvl_error, "(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n", params->state->system_inactivity_ind, params->state->save_unsaved_data_ind, params->state->shutdown_ind, params->state->memory_low_ind, params->state->sig_device_mode_ind); @@ -69,10 +69,10 @@ static void osso_navit(struct navit *nav, int add) { - dbg(1, "Installing osso context for org.navit_project.navit\n"); + dbg(lvl_warning, "Installing osso context for org.navit_project.navit\n"); osso_context = osso_initialize("org.navit_project.navit", version, TRUE, NULL); if (osso_context == NULL) { - dbg(0, "error initiating osso context\n"); + dbg(lvl_error, "error initiating osso context\n"); } osso_hw_set_event_cb(osso_context, NULL, osso_cb_hw_state, nav); @@ -87,7 +87,7 @@ { //struct callback *cb; - dbg(2, "enter\n"); + dbg(lvl_info, "enter\n"); callback.u.callback = callback_new_attr_0(callback_cast(osso_navit), attr_navit); config_add_attr(config, &callback); Modified: trunk/navit/navit/binding/dbus/binding_dbus.c =================================================================== --- trunk/navit/navit/binding/dbus/binding_dbus.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/binding/dbus/binding_dbus.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -84,7 +84,7 @@ { int id; char *ret; - dbg(1,"enter %s\n", type); + dbg(lvl_warning,"enter %s\n", type); if ((ret=g_hash_table_lookup(object_hash_rev, object))) return ret; id=GPOINTER_TO_INT(g_hash_table_lookup(object_count, type)); @@ -92,7 +92,7 @@ ret=g_strdup_printf("%s/%s/%d", object_path, type, id); g_hash_table_insert(object_hash, ret, object); g_hash_table_insert(object_hash_rev, object, ret); - dbg(1,"return %s\n", ret); + dbg(lvl_warning,"return %s\n", ret); return (ret); } @@ -134,7 +134,7 @@ struct attr attr; if (strncmp(opath, object_path, strlen(object_path))) { - dbg(0,"wrong object path %s\n",opath); + dbg(lvl_error,"wrong object path %s\n",opath); return NULL; } prefix=g_strdup_printf("%s/%s/", object_path, type); @@ -151,7 +151,7 @@ if (!config_get_attr(config, attr_navit, &navit, NULL)) return NULL; if (!oprefix[0]) { - dbg(0,"default_navit\n"); + dbg(lvl_error,"default_navit\n"); return navit.u.navit; } if (!strncmp(oprefix,def_graphics,strlen(def_graphics))) { @@ -382,42 +382,42 @@ switch (arg) { case DBUS_TYPE_INT32: dbus_message_iter_get_basic(iter, &vali); - dbg(0,"%sDBUS_TYPE_INT32: %d\n",prefix,vali); + dbg(lvl_error,"%sDBUS_TYPE_INT32: %d\n",prefix,vali); break; case DBUS_TYPE_STRING: dbus_message_iter_get_basic(iter, &vals); - dbg(0,"%sDBUS_TYPE_STRING: %s\n",prefix,vals); + dbg(lvl_error,"%sDBUS_TYPE_STRING: %s\n",prefix,vals); break; case DBUS_TYPE_STRUCT: - dbg(0,"%sDBUS_TYPE_STRUCT:\n",prefix); + dbg(lvl_error,"%sDBUS_TYPE_STRUCT:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; case DBUS_TYPE_VARIANT: - dbg(0,"%sDBUS_TYPE_VARIANT:\n",prefix); + dbg(lvl_error,"%sDBUS_TYPE_VARIANT:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; case DBUS_TYPE_DICT_ENTRY: - dbg(0,"%sDBUS_TYPE_DICT_ENTRY:\n",prefix); + dbg(lvl_error,"%sDBUS_TYPE_DICT_ENTRY:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; case DBUS_TYPE_ARRAY: - dbg(0,"%sDBUS_TYPE_ARRAY:\n",prefix); + dbg(lvl_error,"%sDBUS_TYPE_ARRAY:\n",prefix); prefixr=g_strdup_printf("%s ",prefix); dbus_message_iter_recurse(iter, &iterr); dbus_dump_iter(prefixr, &iterr); g_free(prefixr); break; default: - dbg(0,"%c\n",arg); + dbg(lvl_error,"%c\n",arg); } dbus_message_iter_next(iter); } @@ -517,7 +517,7 @@ dbus_message_iter_get_basic(iter, &attr_type); dbus_message_iter_next(iter); ret=attr_from_name(attr_type); - dbg(1, "attr value: 0x%x string: %s\n", ret, attr_type); + dbg(lvl_warning, "attr value: 0x%x string: %s\n", ret, attr_type); return ret; } @@ -534,7 +534,7 @@ dbus_message_iter_recurse(iter, &iterattr); dbus_message_iter_next(iter); - dbg(1, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr)); + dbg(lvl_warning, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr)); if (attr->type >= attr_type_item_begin && attr->type <= attr_type_item_end) return 0; @@ -812,9 +812,9 @@ destroy_attr(&attr); if (ret) return empty_reply(connection, message); - dbg(0,"failed to set/add/remove attr\n"); + dbg(lvl_error,"failed to set/add/remove attr\n"); } else { - dbg(0,"failed to decode attr\n"); + dbg(lvl_error,"failed to decode attr\n"); } return dbus_error_invalid_parameter(connection, message); } @@ -1121,7 +1121,7 @@ { DBusMessageIter iter2; - dbg(0,"%s\n", dbus_message_iter_get_signature(iter)); + dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(iter)); dbus_message_iter_recurse(iter, &iter2); @@ -1135,7 +1135,7 @@ return 0; dbus_message_iter_get_basic(&iter2, &p->y); - dbg(0, " x -> %x y -> %x\n", p->x, p->y); + dbg(lvl_error, " x -> %x y -> %x\n", p->x, p->y); dbus_message_iter_next(&iter2); @@ -1268,7 +1268,7 @@ return dbus_error_invalid_object_path(connection, message); dbus_message_iter_init(message, &iter); - dbg(0,"%s\n", dbus_message_iter_get_signature(&iter)); + dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(&iter)); dbus_message_iter_get_basic(&iter, &factor); @@ -1313,7 +1313,7 @@ pp=&p; } - dbg(1,"Dumping route from dbus to %s\n", filename); + dbg(lvl_warning,"Dumping route from dbus to %s\n", filename); struct map * map=NULL; struct navigation * nav = NULL; @@ -1392,7 +1392,7 @@ return dbus_error_invalid_object_path(connection, message); dbus_message_iter_init(message, &iter); - dbg(0,"%s\n", dbus_message_iter_get_signature(&iter)); + dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(&iter)); if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) return dbus_error_invalid_parameter(connection, message); @@ -1404,7 +1404,7 @@ return dbus_error_invalid_parameter(connection, message); dbus_message_iter_get_basic(&iter, &h); - dbg(0, " w -> %i h -> %i\n", w, h); + dbg(lvl_error, " w -> %i h -> %i\n", w, h); navit_handle_resize(navit, w, h); @@ -1503,7 +1503,7 @@ dbus_message_iter_next(&iter); dbus_message_iter_get_basic(&iter, &description); - dbg(0, " destination -> %s\n", description); + dbg(lvl_error, " destination -> %s\n", description); navit_set_destination(navit, &pc, description, 1); return empty_reply(connection, message); @@ -1865,7 +1865,7 @@ if (strncmp(object, object_path, strlen(object_path))) return NULL; ret=g_strdup(object+strlen(object_path)); - dbg(1,"path=%s\n",ret); + dbg(lvl_warning,"path=%s\n",ret); for (i = strlen(ret)-1 ; i >= 0 ; i--) { if (ret[i] == '/' || (ret[i] >= '0' && ret[i] <= '9')) ret[i]='\0'; @@ -1893,7 +1893,7 @@ char *path=introspect_path(object); if (!path) return NULL; - dbg(1,"path=%s\n",path); + dbg(lvl_warning,"path=%s\n",path); // write header and make navit introspectable navitintrospectxml = g_strdup_printf("%s%s%s\n", navitintrospectxml_head1, object, navitintrospectxml_head2); @@ -1936,11 +1936,11 @@ { int i; char *path; - dbg(1,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); + dbg(lvl_warning,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) { DBusMessage *reply; char *navitintrospectxml = generate_navitintrospectxml(dbus_message_get_path(message)); - dbg(1,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml); + dbg(lvl_warning,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml); if (navitintrospectxml) { reply = dbus_message_new_method_return(message); dbus_message_append_args(reply, DBUS_TYPE_STRING, &navitintrospectxml, DBUS_TYPE_INVALID); @@ -1974,7 +1974,7 @@ DBusHandlerResult filter(DBusConnection *connection, DBusMessage *message, void *user_data) { - dbg(0,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); + dbg(lvl_error,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message)); if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -1987,7 +1987,7 @@ DBusMessage* msg; char *opath=object_new("navit",navit); char *interface=g_strdup_printf("%s%s", service_name, ".navit"); - dbg(0,"enter %s %s %s\n",opath,command,interface); + dbg(lvl_error,"enter %s %s %s\n",opath,command,interface); msg = dbus_message_new_signal(opath, interface, "signal"); if (msg) { DBusMessageIter iter1,iter2,iter3; @@ -2042,7 +2042,7 @@ object_hash=g_hash_table_new(g_str_hash, g_str_equal); object_hash_rev=g_hash_table_new(NULL, NULL); object_count=g_hash_table_new(g_str_hash, g_str_equal); - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); dbus_error_init(&error); #ifdef DBUS_USE_SYSTEM_BUS connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); @@ -2050,7 +2050,7 @@ connection = dbus_bus_get(DBUS_BUS_SESSION, &error); #endif if (!connection) { - dbg(0,"Failed to open connection to session message bus: %s\n", error.message); + dbg(lvl_error,"Failed to open connection to session message bus: %s\n", error.message); dbus_error_free(&error); return; } @@ -2062,7 +2062,7 @@ dbus_connection_register_fallback(connection, object_path, &dbus_navit_vtable, NULL); dbus_bus_request_name(connection, service_name, 0, &error); if (dbus_error_is_set(&error)) { - dbg(0,"Failed to request name: %s", error.message); + dbg(lvl_error,"Failed to request name: %s", error.message); dbus_error_free (&error); } callback.type=attr_callback; Modified: trunk/navit/navit/binding/python/config.c =================================================================== --- trunk/navit/navit/binding/python/config.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/binding/python/config.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -66,7 +66,7 @@ { configObject *ret; - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); ret=PyObject_NEW(configObject, &config_Type); return (PyObject *)ret; } Modified: trunk/navit/navit/binding/python/navit.c =================================================================== --- trunk/navit/navit/binding/python/navit.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/binding/python/navit.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -44,10 +44,10 @@ if (!PyArg_ParseTuple(args, "s", &name)) return NULL; if (!navit_get_attr(self->navit, attr_from_name(name), &attr, NULL)) { - dbg(0,"get_attr not ok\n"); + dbg(lvl_error,"get_attr not ok\n"); Py_RETURN_NONE; } - dbg(0,"get_attr ok\n"); + dbg(lvl_error,"get_attr ok\n"); return python_object_from_attr(&attr); } @@ -131,7 +131,7 @@ { navitObject *ret; - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); ret=PyObject_NEW(navitObject, &navit_Type); return (PyObject *)ret; } @@ -139,7 +139,7 @@ PyObject * navit_py_ref(struct navit *navit) { - dbg(0,"navit=%p\n", navit); + dbg(lvl_error,"navit=%p\n", navit); navitObject *ret=PyObject_NEW(navitObject, &navit_Type); ret->navit=navit; return (PyObject *)ret; Modified: trunk/navit/navit/binding/python/pcoord.c =================================================================== --- trunk/navit/navit/binding/python/pcoord.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/binding/python/pcoord.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -76,7 +76,7 @@ ret->pc.pro=pro; ret->pc.x=c.x; ret->pc.y=c.y; - dbg(0,"0x%x,0x%x\n", c.x, c.y); + dbg(lvl_error,"0x%x,0x%x\n", c.x, c.y); return (PyObject *)ret; } Modified: trunk/navit/navit/binding/win32/binding_win32.c =================================================================== --- trunk/navit/navit/binding/win32/binding_win32.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/binding/win32/binding_win32.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -60,10 +60,10 @@ static int win32_cmd_send_signal(struct navit *navit, char *command, struct attr **in, struct attr ***out) { - dbg(0,"this function is a stub\n"); + dbg(lvl_error,"this function is a stub\n"); if (in) { while (*in) { - dbg(0,"another attribute to be sent\n"); + dbg(lvl_error,"another attribute to be sent\n"); in++; } } @@ -84,23 +84,23 @@ navit.type=attr_navit; navit.u.navit=this->navit; if(cpd->dwData!=NAVIT_BINDING_W32_DWDATA) { - dbg(0,"COPYDATA message came with wrong DWDATA value, expected %d, got %d.\n",NAVIT_BINDING_W32_DWDATA,cpd->dwData); + dbg(lvl_error,"COPYDATA message came with wrong DWDATA value, expected %d, got %d.\n",NAVIT_BINDING_W32_DWDATA,cpd->dwData); return; } if(cpd->cbData<sizeof(*msg)) { - dbg(0,"COPYDATA message too short, expected >=%d, got %d.\n",sizeof(*msg),cpd->cbData); + dbg(lvl_error,"COPYDATA message too short, expected >=%d, got %d.\n",sizeof(*msg),cpd->cbData); return; } msg=cpd->lpData; if(cpd->dwData!=NAVIT_BINDING_W32_VERSION) { - dbg(0,"Got request with wrong version number, expected %d, got %d.\n",NAVIT_BINDING_W32_VERSION,msg->version); + dbg(lvl_error,"Got request with wrong version number, expected %d, got %d.\n",NAVIT_BINDING_W32_VERSION,msg->version); return; } if(strcmp(NAVIT_BINDING_W32_MAGIC,msg->magic)) { - dbg(0,"Got request with wrong MAGIC, expected %s, got %*s.\n",NAVIT_BINDING_W32_MAGIC, msg->magic,sizeof(msg->magic)); + dbg(lvl_error,"Got request with wrong MAGIC, expected %s, got %*s.\n",NAVIT_BINDING_W32_MAGIC, msg->magic,sizeof(msg->magic)); return; } - dbg(0,"Running command %s\n", msg->text); + dbg(lvl_error,"Running command %s\n", msg->text); command_evaluate(&navit, msg->text); } @@ -120,9 +120,9 @@ win32_main_navit(struct win32_binding_private *this, struct navit *navit, int added) { struct attr attr; - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); if (added==1) { - dbg(0,"enter2\n"); + dbg(lvl_error,"enter2\n"); this->navit=navit; command_add_table_attr(commands, sizeof(commands)/sizeof(struct command_table), navit, &attr); navit_add_attr(navit, &attr); @@ -137,7 +137,7 @@ { struct attr callback; struct win32_binding_private *this=g_new0(struct win32_binding_private,1); - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); callback.type=attr_callback; callback.u.callback=callback_new_attr_1(callback_cast(win32_main_navit),attr_navit,this); config_add_attr(config, &callback); Modified: trunk/navit/navit/bookmarks.c =================================================================== --- trunk/navit/navit/bookmarks.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/bookmarks.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -83,7 +83,7 @@ void bookmarks_move_root(struct bookmarks *this_) { this_->current=this_->root; this_->current->iter=g_list_first(this_->current->children); - dbg(2,"Root list have %u entries\n",g_list_length(this_->current->children)); + dbg(lvl_info,"Root list have %u entries\n",g_list_length(this_->current->children)); return; } void bookmarks_move_up(struct bookmarks *this_) { @@ -103,7 +103,7 @@ if (!strcmp(data->label,name)) { this_->current=(struct bookmark_item_priv*)this_->current->iter->data; this_->current->iter=g_list_first(this_->current->children); - dbg(2,"%s list have %u entries\n",this_->current->label,g_list_length(this_->current->children)); + dbg(lvl_info,"%s list have %u entries\n",this_->current->label,g_list_length(this_->current->children)); return 1; } this_->current->iter=g_list_next(this_->current->iter); @@ -207,7 +207,7 @@ finder=b_item->label; while ((pos=strchr(finder,'/'))) { *pos=0x00; - dbg(1,"Found path entry: %s\n",finder); + dbg(lvl_warning,"Found path entry: %s\n",finder); if (!bookmarks_move_down(this_,finder)) { struct bookmark_item_priv *path_item=g_new0(struct bookmark_item_priv,1); path_item->type=type_bookmark_folder; @@ -231,7 +231,7 @@ this_->bookmarks_list=g_list_append(this_->bookmarks_list,b_item); this_->current->children=g_list_append(this_->current->children,b_item); this_->current->children=g_list_first(this_->current->children); - dbg(1,"Added %s to %s and current list now %u long\n",b_item->label,this_->current->label,g_list_length(this_->current->children)); + dbg(lvl_warning,"Added %s to %s and current list now %u long\n",b_item->label,this_->current->label,g_list_length(this_->current->children)); } bookmarks_move_root(this_); } @@ -327,7 +327,7 @@ g_free(fullname); fullname=g_strdup(pathHelper); g_free(pathHelper); - dbg(1,"full name: %s\n",fullname); + dbg(lvl_warning,"full name: %s\n",fullname); } } @@ -760,7 +760,7 @@ } fclose(f); } else { - dbg(0, "Error updating destinations file %s: %s\n", former_destination_file, strerror(errno)); + dbg(lvl_error, "Error updating destinations file %s: %s\n", former_destination_file, strerror(errno)); } } /** Modified: trunk/navit/navit/cache.c =================================================================== --- trunk/navit/navit/cache.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/cache.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -33,13 +33,13 @@ cache_entry_dump(struct cache *cache, struct cache_entry *entry) { int i,size; - dbg(0,"Usage: %d size %d\n",entry->usage, entry->size); + dbg(lvl_error,"Usage: %d size %d\n",entry->usage, entry->size); if (cache) size=cache->id_size; else size=5; for (i = 0 ; i < size ; i++) { - dbg(0,"0x%x\n", entry->id[i]); + dbg(lvl_error,"0x%x\n", entry->id[i]); } } @@ -47,7 +47,7 @@ cache_list_dump(char *str, struct cache *cache, struct cache_entry_list *list) { struct cache_entry *first=list->first; - dbg(0,"dump %s %d\n",str, list->size); + dbg(lvl_error,"dump %s %d\n",str, list->size); while (first) { cache_entry_dump(cache, first); first=first->next; @@ -106,7 +106,7 @@ cache->hash=g_hash_table_new(cache_hash20, cache_equal20); break; default: - dbg(0,"cache with id_size of %d not supported\n", id_size); + dbg(lvl_error,"cache with id_size of %d not supported\n", id_size); g_free(cache); cache=NULL; } @@ -152,7 +152,7 @@ static void cache_remove(struct cache *cache, struct cache_entry *entry) { - dbg(1,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_warning,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); g_hash_table_remove(cache->hash, (gpointer)(entry->id)); g_slice_free1(entry->size, entry); } @@ -185,7 +185,7 @@ last=list->last; if (! last || last->usage || seen >= list->size) return NULL; - dbg(1,"removing %d\n", last->id[0]); + dbg(lvl_warning,"removing %d\n", last->id[0]); cache_remove_lru_helper(list); if (cache) { cache_remove(cache, last); @@ -211,7 +211,7 @@ cache_entry_destroy(struct cache *cache, void *data) { struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size); - dbg(1,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_warning,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); entry->usage--; } @@ -219,8 +219,8 @@ cache_trim(struct cache *cache, struct cache_entry *entry) { struct cache_entry *new_entry; - dbg(1,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); - dbg(1,"Trim %x from %d -> %d\n", entry->id[0], entry->size, cache->size); + dbg(lvl_warning,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_warning,"Trim %x from %d -> %d\n", entry->id[0], entry->size, cache->size); if ( cache->entry_size < entry->size ) { g_hash_table_remove(cache->hash, (gpointer)(entry->id)); @@ -256,11 +256,11 @@ cache_replace(struct cache *cache) { if (cache->t1.size >= MAX(1,cache->t1_target)) { - dbg(1,"replace 12\n"); + dbg(lvl_warning,"replace 12\n"); if (!cache_move(cache, &cache->t1, &cache->b1)) cache_move(cache, &cache->t2, &cache->b2); } else { - dbg(1,"replace t2\n"); + dbg(lvl_warning,"replace t2\n"); if (!cache_move(cache, &cache->t2, &cache->b2)) cache_move(cache, &cache->t1, &cache->b1); } @@ -298,17 +298,17 @@ cache_lookup(struct cache *cache, void *id) { struct cache_entry *entry; - dbg(1,"get %d\n", ((int *)id)[0]); + dbg(lvl_warning,"get %d\n", ((int *)id)[0]); entry=g_hash_table_lookup(cache->hash, id); if (entry == NULL) { cache->insert=&cache->t1; #ifdef DEBUG_CACHE fprintf(stderr,"-"); #endif - dbg(1,"not in cache\n"); + dbg(lvl_warning,"not in cache\n"); return NULL; } - dbg(1,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_warning,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); if (entry->where == &cache->t1 || entry->where == &cache->t2) { cache->hits+=entry->size; #ifdef DEBUG_CACHE @@ -317,7 +317,7 @@ else fprintf(stderr,"H"); #endif - dbg(1,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2"); + dbg(lvl_warning,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2"); cache_remove_from_list(entry->where, entry); cache_insert_mru(NULL, &cache->t2, entry); entry->usage++; @@ -327,18 +327,18 @@ #ifdef DEBUG_CACHE fprintf(stderr,"m"); #endif - dbg(1,"in phantom cache B1\n"); + dbg(lvl_warning,"in phantom cache B1\n"); cache->t1_target=MIN(cache->t1_target+MAX(cache->b2.size/cache->b1.size, 1),cache->size); cache_remove_from_list(&cache->b1, entry); } else if (entry->where == &cache->b2) { #ifdef DEBUG_CACHE fprintf(stderr,"M"); #endif - dbg(1,"in phantom cache B2\n"); + dbg(lvl_warning,"in phantom cache B2\n"); cache->t1_target=MAX(cache->t1_target-MAX(cache->b1.size/cache->b2.size, 1),0); cache_remove_from_list(&cache->b2, entry); } else { - dbg(0,"**ERROR** invalid where\n"); + dbg(lvl_error,"**ERROR** invalid where\n"); } cache_replace(cache); cache_remove(cache, entry); @@ -351,7 +351,7 @@ cache_insert(struct cache *cache, void *data) { struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size); - dbg(1,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); + dbg(lvl_warning,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]); if (cache->insert == &cache->t1) { if (cache->t1.size + cache->b1.size >= cache->size) { if (cache->t1.size < cache->size) { @@ -382,8 +382,8 @@ static void cache_stats(struct cache *cache) { - dbg(0,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target); - dbg(0,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size); + dbg(lvl_error,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target); + dbg(lvl_error,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size); cache->hits=0; cache->misses=0; } @@ -396,6 +396,6 @@ cache_list_dump("B1", cache, &cache->b1); cache_list_dump("T2", cache, &cache->t2); cache_list_dump("B2", cache, &cache->b2); - dbg(0,"dump end\n"); + dbg(lvl_error,"dump end\n"); } Modified: trunk/navit/navit/callback.c =================================================================== --- trunk/navit/navit/callback.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/callback.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -145,13 +145,13 @@ if (! cb) return; if (cb->pcount + pcount <= 8) { - dbg(3,"cb->pcount=%d\n", cb->pcount); + dbg(lvl_debug,"cb->pcount=%d\n", cb->pcount); if (cb->pcount && cb->p) - dbg(3,"cb->p[0]=%p\n", cb->p[0]); - dbg(3,"pcount=%d\n", pcount); + dbg(lvl_debug,"cb->p[0]=%p\n", cb->p[0]); + dbg(lvl_debug,"pcount=%d\n", pcount); if (pcount) { dbg_assert(p!=NULL); - dbg(3,"p[0]=%p\n", p[0]); + dbg(lvl_debug,"p[0]=%p\n", p[0]); } for (i = 0 ; i < cb->pcount ; i++) pf[i]=cb->p[i]; @@ -195,7 +195,7 @@ break; } } else { - dbg(0,"too many parameters for callback (%d+%d)\n", cb->pcount, pcount); + dbg(lvl_error,"too many parameters for callback (%d+%d)\n", cb->pcount, pcount); } } Modified: trunk/navit/navit/command.c =================================================================== --- trunk/navit/navit/command.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/command.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -152,8 +152,8 @@ if (res->attrn) strncpy(attribute, res->attrn, res->attrnlen); attribute[res->attrnlen]='\0'; - dbg(0,"type:%s\n", attr_to_name(res->attr.type)); - dbg(0,"attribute '%s' from '%s'\n", attribute, object); + dbg(lvl_error,"type:%s\n", attr_to_name(res->attr.type)); + dbg(lvl_error,"attribute '%s' from '%s'\n", attribute, object); #endif } @@ -315,7 +315,7 @@ return res->attr.u.data != NULL; if (is_bool && ATTR_IS_STRING(res->attr.type)) return res->attr.u.data != NULL; - dbg(0,"bool %d %s\n",is_bool,attr_to_name(res->attr.type)); + dbg(lvl_error,"bool %d %s\n",is_bool,attr_to_name(res->attr.type)); ctx->error=wrong_type; return 0; } @@ -481,7 +481,7 @@ default: break; } - dbg(0,"Unkown op %d %s\n",op_type,op); + dbg(lvl_error,"Unkown op %d %s\n",op_type,op); ctx->error=internal; } @@ -518,7 +518,7 @@ default: break; } - dbg(0,"unknown set type %d %s\n",set_type,op); + dbg(lvl_error,"unknown set type %d %s\n",set_type,op); ctx->error=internal; } @@ -605,7 +605,7 @@ if (!*op) ctx->error=eof_reached; else { - dbg(0,"illegal character 0x%x\n",*op); + dbg(lvl_error,"illegal character 0x%x\n",*op); ctx->error=illegal_character; } } @@ -657,7 +657,7 @@ if (res->attrn) strncpy(function, res->attrn, res->attrnlen); function[res->attrnlen]='\0'; - dbg(1,"function=%s\n", function); + dbg(lvl_warning,"function=%s\n", function); if (ctx->expr[0] != ')') { list=eval_list(ctx); if (ctx->error) { @@ -686,7 +686,7 @@ res->attr.u.num=list[0]->u.num; res->allocated=0; } else { - dbg(0,"don't know how to create int of args\n"); + dbg(lvl_error,"don't know how to create int of args\n"); } } else if (ATTR_IS_STRING(attr_type)) { if (list && list[0] && ATTR_IS_STRING(list[0]->type)) { @@ -694,7 +694,7 @@ res->attr.u.str=g_strdup(list[0]->u.str); res->allocated=1; } else { - dbg(0,"don't know how to create string of args\n"); + dbg(lvl_error,"don't know how to create string of args\n"); } } else if (ATTR_IS_OBJECT(attr_type)) { struct object_func *func=object_func_lookup(attr_type); @@ -706,7 +706,7 @@ res->allocated=1; } } else { - dbg(0,"don't know how to create %s (%s)\n",attr_to_name(attr_type),function+4); + dbg(lvl_error,"don't know how to create %s (%s)\n",attr_to_name(attr_type),function+4); } } else if (!strcmp(function,"add_attr")) { command_object_add_attr(ctx, &res->attr, list[0]); @@ -716,10 +716,10 @@ if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) { int valid =0; struct attr **out=NULL; - dbg(1,"function call %s from %s\n",function, attr_to_name(res->attr.type)); + dbg(lvl_warning,"function call %s from %s\n",function, attr_to_name(res->attr.type)); callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, &out, &valid); if (valid!=1){ - dbg(0, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/" + dbg(lvl_error, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/" "The_Navit_Command_Interface for valid commands.\n", function); } if (out && out[0]) { @@ -770,15 +770,15 @@ enum attr_type attr_type=command_attr_type(res); void *obj=res->attr.u.data; if (!obj) { - dbg(0,"no object\n"); + dbg(lvl_error,"no object\n"); return; } if (!obj_func) { - dbg(0,"no object func\n"); + dbg(lvl_error,"no object func\n"); return; } if (!obj_func->iter_new || !obj_func->iter_destroy) { - dbg(0,"no iter func\n"); + dbg(lvl_error,"no iter func\n"); return; } iter = obj_func->iter_new(NULL); @@ -801,7 +801,7 @@ return; } } else if (op[0] == '(') { - dbg(1,"function call\n"); + dbg(lvl_warning,"function call\n"); resolve_object(ctx, res); command_call_function(ctx, res); } @@ -989,7 +989,7 @@ memset(&tmp,0,sizeof(tmp)); if (!get_op(ctx,0,":",NULL)) { - dbg(0,"ctxerr\n"); + dbg(lvl_error,"ctxerr\n"); ctx->error=missing_colon; return; } @@ -1110,7 +1110,7 @@ return attr_none; resolve_object(&ctx, &res); *ret=res.attr; - dbg(1,"type %s\n",attr_to_name(command_attr_type(&res))); + dbg(lvl_warning,"type %s\n",attr_to_name(command_attr_type(&res))); return command_attr_type(&res); } @@ -1280,15 +1280,15 @@ } end=ctx->expr; if (!obj) { - dbg(0,"no object\n"); + dbg(lvl_error,"no object\n"); return 0; } if (!obj_func) { - dbg(0,"no object func\n"); + dbg(lvl_error,"no object func\n"); return 0; } if (!obj_func->iter_new || !obj_func->iter_destroy) { - dbg(0,"no iter func\n"); + dbg(lvl_error,"no iter func\n"); return 0; } iter = obj_func->iter_new(NULL); @@ -1372,7 +1372,7 @@ char expr[32]; strncpy(expr, ctx.expr, 32); expr[31]='\0'; - dbg(0,"error %d starting at %s\n",ctx.error,expr); + dbg(lvl_error,"error %d starting at %s\n",ctx.error,expr); } g_free(expr_dup); } @@ -1507,7 +1507,7 @@ func = object_func_lookup(cs->cbs[i].attr.type); if (!func->remove_attr) { - dbg(0, "Could not remove command-evaluation callback because remove_attr is missing for type %i!\n", cs->cbs[i].attr.type); + dbg(lvl_error, "Could not remove command-evaluation callback because remove_attr is missing for type %i!\n", cs->cbs[i].attr.type); continue; } @@ -1557,7 +1557,7 @@ cb = callback_new_attr_1(callback_cast(command_saved_evaluate), cs->res.attr.type, (void*)cs); cs->ctx.attr = &cs->context_attr; } else { - dbg(0, "Error: Strange status returned from get_next_object()\n"); + dbg(lvl_error, "Error: Strange status returned from get_next_object()\n"); } cs->num_cbs++; @@ -1571,7 +1571,7 @@ func->add_attr(prev.u.data, &cb_attr); } else { - dbg(0, "Could not add callback because add_attr is missing for type %i}n", prev.type); + dbg(lvl_error, "Could not add callback because add_attr is missing for type %i}n", prev.type); } } Modified: trunk/navit/navit/config_.c =================================================================== --- trunk/navit/navit/config_.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/config_.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -60,7 +60,7 @@ static void config_terminate(int sig) { - dbg(0,"terminating\n"); + dbg(lvl_error,"terminating\n"); config_destroy(config); } @@ -142,11 +142,11 @@ config_new(struct attr *parent, struct attr **attrs) { if (configured) { - dbg(0,"only one config allowed\n"); + dbg(lvl_error,"only one config allowed\n"); return config; } if (parent) { - dbg(0,"no parent in config allowed\n"); + dbg(lvl_error,"no parent in config allowed\n"); return NULL; } if (!config) @@ -156,7 +156,7 @@ config->attrs=attr_generic_add_attr_list(config->attrs, attrs); while (*attrs) { if (!config_set_attr_int(config,*attrs)) { - dbg(0,"failed to set attribute '%s'\n",attr_to_name((*attrs)->type)); + dbg(lvl_error,"failed to set attribute '%s'\n",attr_to_name((*attrs)->type)); config_destroy(config); config=NULL; break; Modified: trunk/navit/navit/coord.c =================================================================== --- trunk/navit/navit/coord.c 2014-11-22 21:10:56 UTC (rev 5959) +++ trunk/navit/navit/coord.c 2014-11-22 22:34:19 UTC (rev 5960) @@ -104,7 +104,7 @@ dbg_assert(r1->lu.y >= r1->rl.y); dbg_assert(r2->lu.x <= r2->rl.x); dbg_assert(r2->lu.y >= r2->rl.y); - dbg(3,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y); + dbg(lvl_debug,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y); if (r1->lu.x > r2->rl.x) return 0; if (r1->rl.x < r2->lu.x) @@ -171,14 +171,14 @@ struct coord c,offset; enum projection str_pro=projection_none; - dbg(1,"enter('%s',%d,%p)\n", coord_input, output_projection, result); + dbg(lvl_warning,"enter('%s',%d,%p)\n", coord_input, output_projection, result); s=strchr(str,' '); co=strchr(str,':'); if (co && co < s) { proj=malloc(co-str+1); strncpy(proj, str, co-str); proj[co-str]='\0'; - dbg(1,"projection=%s\n", proj); + dbg(lvl_warning,"projection=%s\n", proj); str=co+1; s=strchr(str,' '); if (!strcmp(proj, "geo")) @@ -186,7 +186,7 @@ else { str_pro = projection_from_name(proj,&offset); if (str_pro == projection_none) { - dbg(0, "Unknown projection: %s\n", proj); + dbg(lvl_error, "Unknown projection: %s\n", proj); goto out; } } @@ -202,8 +202,8 @@ args=sscanf(str, "%i %i%n",&c.x, &c.y, &ret); if (args < 2) goto out; - dbg(1,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret); - dbg(1,"rest='%s'\n", str+ret); + dbg(lvl_warning,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret); + dbg(lvl_warning,"rest='%s'\n", str+ret); if (str_pro == projection_none) str_pro=projection_mg; @@ -215,13 +215,13 @@ } else if (*s == 'N' || *s == 'n' || *s == 'S' || *s == 's') { double lng, lat; char ns, ew; - dbg(1,"str='%s'\n", str); + dbg(lvl_warning,"str='%s'\n", str); args=sscanf(str, "%lf %c %lf %c%n", &lat, &ns, &lng, &ew, &ret); - dbg(1,"args=%d\n", args); - dbg(1,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew); + dbg(lvl_warning,"args=%d\n", args); + dbg(lvl_warning,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew); if (args < 4) goto out; - dbg(1,"projection=%d str_pro=%d projection_none=%d\n", output_projection, str_pro, projection_none); + dbg(lvl_warning,"projection=%d str_pro=%d projection_none=%d\n", output_projection, str_pro, projection_none); if (str_pro == projection_none) { g.lat=floor(lat/100); lat-=g.lat*100; @@ -233,12 +233,12 @@ g.lat=-g.lat; if (ew == 'w' || ew == 'W') g.lng=-g.lng; - dbg(1,"transform_from_geo(%f,%f)",g.lat,g.lng); + dbg(lvl_warning,"transform_from_geo(%f,%f)",g.lat,g.lng); ... [truncated message content] |
From: <mvg...@us...> - 2014-11-22 21:10:59
|
Revision: 5959 http://sourceforge.net/p/navit/code/5959 Author: mvglasow Date: 2014-11-22 21:10:56 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Add:port/android:Change vehicle.position_valid when losing GPS fix Signed-off-by: mvglasow <michael -at- vonglasow.com> Modified Paths: -------------- trunk/navit/navit/vehicle/android/vehicle_android.c Modified: trunk/navit/navit/vehicle/android/vehicle_android.c =================================================================== --- trunk/navit/navit/vehicle/android/vehicle_android.c 2014-11-22 21:01:24 UTC (rev 5958) +++ trunk/navit/navit/vehicle/android/vehicle_android.c 2014-11-22 21:10:56 UTC (rev 5959) @@ -47,7 +47,7 @@ char fixiso8601[128]; /**< Timestamp of last fix in ISO 8601 format **/ int sats; /**< Number of satellites in view **/ int sats_used; /**< Number of satellites used in fix **/ - int have_coords; /**< Whether the vehicle coordinates in {@code geo} are valid **/ + int valid; /**< Whether the vehicle coordinates in {@code geo} are valid **/ struct attr ** attrs; struct callback *pcb; /**< The callback function for position updates **/ struct callback *scb; /**< The callback function for status updates **/ @@ -108,14 +108,14 @@ break; case attr_position_coord_geo: attr->u.coord_geo = &priv->geo; - if (!priv->have_coords) + if (priv->valid == attr_position_valid_invalid) return 0; break; case attr_position_time_iso8601: attr->u.str=priv->fixiso8601; break; case attr_position_valid: - attr->u.num = priv->have_coords ? attr_position_valid_valid : attr_position_valid_invalid; + attr->u.num = priv->valid; break; default: return 0; @@ -154,8 +154,8 @@ tm = gmtime(&tnow); strftime(v->fixiso8601, sizeof(v->fixiso8601), "%Y-%m-%dT%TZ", tm); dbg(1,"lat %f lon %f time %s\n",v->geo.lat,v->geo.lng,v->fixiso8601); - if (!v->have_coords) { - v->have_coords=1; + if (v->valid != attr_position_valid_valid) { + v->valid = attr_position_valid_valid; callback_list_call_attr_0(v->cbl, attr_position_valid); } callback_list_call_attr_0(v->cbl, attr_position_coord_geo); @@ -166,6 +166,11 @@ * * This function is called by {@code NavitLocationListener} upon receiving a new {@code GpsStatus}. * + * Note that {@code sats_used} should not be used to determine whether the vehicle's position is valid: + * some devices report non-zero numbers even when they do not have a fix. Position validity should be + * determined in {@code vehicle_android_fix_callback} (an invalid fix type means we have lost the fix) + * and {@code vehicle_android_position_callback} (receiving a position means we have a fix). + * * @param v The {@code struct_vehicle_priv} for the vehicle * @param sats_in_view The number of satellites in view * @param sats_used The number of satellites currently used to determine the position @@ -195,6 +200,10 @@ if (v->fix_type != fix_type) { v->fix_type = fix_type; callback_list_call_attr_0(v->cbl, attr_position_fix_type); + if (!fix_type && (v->valid == attr_position_valid_valid)) { + v->valid = attr_position_valid_extrapolated_time; + callback_list_call_attr_0(v->cbl, attr_position_valid); + } } } @@ -264,7 +273,7 @@ ret->pcb = callback_new_1(callback_cast(vehicle_android_position_callback), ret); ret->scb = callback_new_1(callback_cast(vehicle_android_status_callback), ret); ret->fcb = callback_new_1(callback_cast(vehicle_android_fix_callback), ret); - ret->have_coords = 0; + ret->valid = attr_position_valid_invalid; ret->sats = 0; ret->sats_used = 0; *meth = vehicle_android_methods; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mvg...@us...> - 2014-11-22 21:01:31
|
Revision: 5958 http://sourceforge.net/p/navit/code/5958 Author: mvglasow Date: 2014-11-22 21:01:24 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Refactoring:core:document values for attr_position_valid Signed-off-by: mvglasow <michael -at- vonglasow.com> Modified Paths: -------------- trunk/navit/navit/attr.h Modified: trunk/navit/navit/attr.h =================================================================== --- trunk/navit/navit/attr.h 2014-11-22 15:55:28 UTC (rev 5957) +++ trunk/navit/navit/attr.h 2014-11-22 21:01:24 UTC (rev 5958) @@ -101,12 +101,21 @@ #define ATTR_REL_MAXABS 0x40000000 #define ATTR_REL_RELSHIFT 0x60000000 +/** Indicates whether a position is valid **/ enum attr_position_valid { - attr_position_valid_invalid, - attr_position_valid_static, - attr_position_valid_extrapolated_time, - attr_position_valid_extrapolated_spatial, - attr_position_valid_valid, + attr_position_valid_invalid, /**< The position is invalid and should be discarded. **/ + attr_position_valid_static, /**< The position is valid but the vehicle is not moving, or moving very slowly. + Calculations that involve the difference between two consecutive positions, + such as bearing, may therefore be inaccurate. **/ + attr_position_valid_extrapolated_time, /**< FIXME: this description is just my (mvglasow) guess; this value is not used anywhere as of r5957. + The position is the vehicle's last known position, and the consumer of the + information should be aware that the vehicle may have moved since. **/ + attr_position_valid_extrapolated_spatial, /**< FIXME: this description is just my (mvglasow) guess; this value is not used anywhere as of r5957. + The position is a prediction of the vehicle's current position, based on + its last known position, the time elapsed since it was obtained and possibly + other factors. This would be used for positions obtained through inertial + navigation. **/ + attr_position_valid_valid, /**< The position is valid and can be used for all purposes. **/ }; #define ATTR_IS_INT(x) ((x) >= attr_type_int_begin && (x) <= attr_type_int_end) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mvg...@us...> - 2014-11-22 15:55:37
|
Revision: 5957 http://sourceforge.net/p/navit/code/5957 Author: mvglasow Date: 2014-11-22 15:55:28 +0000 (Sat, 22 Nov 2014) Log Message: ----------- Add:port/android:Make gps_status OSD work on Android Signed-off-by: mvglasow <michael -at- vonglasow.com> Modified Paths: -------------- trunk/navit/navit/android/src/org/navitproject/navit/NavitVehicle.java trunk/navit/navit/vehicle/android/vehicle_android.c Modified: trunk/navit/navit/android/src/org/navitproject/navit/NavitVehicle.java =================================================================== --- trunk/navit/navit/android/src/org/navitproject/navit/NavitVehicle.java 2014-11-22 15:50:40 UTC (rev 5956) +++ trunk/navit/navit/android/src/org/navitproject/navit/NavitVehicle.java 2014-11-22 15:55:28 UTC (rev 5957) @@ -19,8 +19,13 @@ package org.navitproject.navit; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.location.Criteria; +import android.location.GpsSatellite; +import android.location.GpsStatus; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; @@ -28,11 +33,16 @@ import android.util.Log; public class NavitVehicle { + + public static final String GPS_FIX_CHANGE = "android.location.GPS_FIX_CHANGE"; public static Location lastLocation = null; private static LocationManager sLocationManager = null; - private int vehicle_callbackid; + private static Context context = null; + private int vehicle_pcbid; + private int vehicle_scbid; + private int vehicle_fcbid; private String preciseProvider; private String fastProvider; @@ -40,8 +50,10 @@ private static NavitLocationListener fastLocationListener = null; public native void VehicleCallback(int id, Location location); + public native void VehicleCallback(int id, int satsInView, int satsUsed); + public native void VehicleCallback(int id, int enabled); - private class NavitLocationListener implements LocationListener { + private class NavitLocationListener extends BroadcastReceiver implements GpsStatus.Listener, LocationListener { public boolean precise = false; public void onLocationChanged(Location location) { lastLocation = location; @@ -51,14 +63,52 @@ fastProvider = null; } - VehicleCallback(vehicle_callbackid, location); + VehicleCallback(vehicle_pcbid, location); + VehicleCallback(vehicle_fcbid, 1); } public void onProviderDisabled(String provider){} public void onProviderEnabled(String provider) {} public void onStatusChanged(String provider, int status, Bundle extras) {} + + /** + * Called when the status of the GPS changes. + */ + public void onGpsStatusChanged (int event) { + GpsStatus status = sLocationManager.getGpsStatus(null); + int satsInView = 0; + int satsUsed = 0; + Iterable<GpsSatellite> sats = status.getSatellites(); + for (GpsSatellite sat : sats) { + satsInView++; + if (sat.usedInFix()) { + satsUsed++; + } + } + VehicleCallback(vehicle_scbid, satsInView, satsUsed); + } + + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(GPS_FIX_CHANGE)) { + if (intent.getBooleanExtra("enabled", false)) + VehicleCallback(vehicle_fcbid, 1); + else if (!intent.getBooleanExtra("enabled", true)) + VehicleCallback(vehicle_fcbid, 0); + } + } } - NavitVehicle (Context context, int callbackid) { + /** + * @brief Creates a new {@code NavitVehicle} + * + * @param context + * @param pcbid The address of the position callback function which will be called when a location update is received + * @param scbid The address of the status callback function which will be called when a status update is received + * @param fcbid The address of the fix callback function which will be called when a + * {@code android.location.GPS_FIX_CHANGE} is received, indicating a change in GPS fix status + */ + NavitVehicle (Context context, int pcbid, int scbid, int fcbid) { + this.context = context; sLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); preciseLocationListener = new NavitLocationListener(); preciseLocationListener.precise = true; @@ -90,9 +140,13 @@ Log.e("NavitVehicle", "Precise Provider " + preciseProvider); fastProvider = sLocationManager.getBestProvider(lowCriteria, false); Log.e("NavitVehicle", "Fast Provider " + fastProvider); - vehicle_callbackid=callbackid; + vehicle_pcbid = pcbid; + vehicle_scbid = scbid; + vehicle_fcbid = fcbid; + context.registerReceiver(preciseLocationListener, new IntentFilter(GPS_FIX_CHANGE)); sLocationManager.requestLocationUpdates(preciseProvider, 0, 0, preciseLocationListener); + sLocationManager.addGpsStatusListener(preciseLocationListener); // If the 2 providers are the same, only activate one listener if (fastProvider == null || preciseProvider.compareTo(fastProvider) == 0) { @@ -104,7 +158,11 @@ public static void removeListener() { if (sLocationManager != null) { - if (preciseLocationListener != null) sLocationManager.removeUpdates(preciseLocationListener); + if (preciseLocationListener != null) { + sLocationManager.removeUpdates(preciseLocationListener); + sLocationManager.removeGpsStatusListener(preciseLocationListener); + context.unregisterReceiver(preciseLocationListener); + } if (fastLocationListener != null) sLocationManager.removeUpdates(fastLocationListener); } Modified: trunk/navit/navit/vehicle/android/vehicle_android.c =================================================================== --- trunk/navit/navit/vehicle/android/vehicle_android.c 2014-11-22 15:50:40 UTC (rev 5956) +++ trunk/navit/navit/vehicle/android/vehicle_android.c 2014-11-22 15:55:28 UTC (rev 5957) @@ -42,17 +42,19 @@ double direction; /**< Bearing in degrees **/ double height; /**< Elevation in meters **/ double radius; /**< Position accuracy in meters **/ - int fix_type; /**< Type of last fix (not used) **/ + int fix_type; /**< Type of last fix (1 = valid, 0 = invalid) **/ time_t fix_time; /**< Timestamp of last fix (not used) **/ char fixiso8601[128]; /**< Timestamp of last fix in ISO 8601 format **/ - int sats; /**< Number of satellites in view (currently not used) **/ - int sats_used; /**< Number of satellites used in fix (currently not used) **/ + int sats; /**< Number of satellites in view **/ + int sats_used; /**< Number of satellites used in fix **/ int have_coords; /**< Whether the vehicle coordinates in {@code geo} are valid **/ struct attr ** attrs; - struct callback *cb; - jclass NavitVehicleClass; - jobject NavitVehicle; - jclass LocationClass; + struct callback *pcb; /**< The callback function for position updates **/ + struct callback *scb; /**< The callback function for status updates **/ + struct callback *fcb; /**< The callback function for fix status updates **/ + jclass NavitVehicleClass; /**< The {@code NavitVehicle} class **/ + jobject NavitVehicle; /**< An instance of {@code NavitVehicle} **/ + jclass LocationClass; /**< Android's {@code Location} class **/ jmethodID Location_getLatitude, Location_getLongitude, Location_getSpeed, Location_getBearing, Location_getAltitude, Location_getTime, Location_getAccuracy; }; @@ -83,11 +85,9 @@ { dbg(1,"enter %s\n",attr_to_name(type)); switch (type) { -#if 0 case attr_position_fix_type: attr->u.num = priv->fix_type; break; -#endif case attr_position_height: attr->u.numd = &priv->height; break; @@ -100,15 +100,12 @@ case attr_position_radius: attr->u.numd = &priv->radius; break; - -#if 0 case attr_position_qual: attr->u.num = priv->sats; break; case attr_position_sats_used: attr->u.num = priv->sats_used; break; -#endif case attr_position_coord_geo: attr->u.coord_geo = &priv->geo; if (!priv->have_coords) @@ -133,9 +130,16 @@ vehicle_android_position_attr_get, }; +/** + * @brief Called when a new position has been reported + * + * This function is called by {@code NavitLocationListener} upon receiving a new {@code Location}. + * + * @param v The {@code struct_vehicle_priv} for the vehicle + * @param location A {@code Location} object describing the new position + */ static void -vehicle_android_callback(struct vehicle_priv *v, jobject location) -{ +vehicle_android_position_callback(struct vehicle_priv *v, jobject location) { time_t tnow; struct tm *tm; dbg(1,"enter\n"); @@ -157,6 +161,48 @@ callback_list_call_attr_0(v->cbl, attr_position_coord_geo); } +/** + * @brief Called when a new GPS status has been reported + * + * This function is called by {@code NavitLocationListener} upon receiving a new {@code GpsStatus}. + * + * @param v The {@code struct_vehicle_priv} for the vehicle + * @param sats_in_view The number of satellites in view + * @param sats_used The number of satellites currently used to determine the position + */ +static void +vehicle_android_status_callback(struct vehicle_priv *v, int sats_in_view, int sats_used) { + if (v->sats != sats_in_view) { + v->sats = sats_in_view; + callback_list_call_attr_0(v->cbl, attr_position_qual); + } + if (v->sats_used != sats_used) { + v->sats_used = sats_used; + callback_list_call_attr_0(v->cbl, attr_position_sats_used); + } +} + +/** + * @brief Called when a change in GPS fix status has been reported + * + * This function is called by {@code NavitLocationListener} upon receiving a new {@code android.location.GPS_FIX_CHANGE} broadcast. + * + * @param v The {@code struct_vehicle_priv} for the vehicle + * @param fix_type The fix type (1 = valid, 0 = invalid) + */ +static void +vehicle_android_fix_callback(struct vehicle_priv *v, int fix_type) { + if (v->fix_type != fix_type) { + v->fix_type = fix_type; + callback_list_call_attr_0(v->cbl, attr_position_fix_type); + } +} + +/** + * @brief Initializes an Android vehicle + * + * @return True on success, false on failure + */ static int vehicle_android_init(struct vehicle_priv *ret) { @@ -181,13 +227,13 @@ if (!android_find_class_global("org/navitproject/navit/NavitVehicle", &ret->NavitVehicleClass)) return 0; dbg(0,"at 3\n"); - cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;I)V"); + cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;III)V"); if (cid == NULL) { dbg(0,"no method found\n"); return 0; /* exception thrown */ } dbg(0,"at 4 android_activity=%p\n",android_activity); - ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->cb); + ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->pcb, (int) ret->scb, (int) ret->fcb); dbg(0,"result=%p\n",ret->NavitVehicle); if (!ret->NavitVehicle) return 0; @@ -215,8 +261,12 @@ dbg(0, "enter\n"); ret = g_new0(struct vehicle_priv, 1); ret->cbl = cbl; - ret->cb=callback_new_1(callback_cast(vehicle_android_callback), ret); + ret->pcb = callback_new_1(callback_cast(vehicle_android_position_callback), ret); + ret->scb = callback_new_1(callback_cast(vehicle_android_status_callback), ret); + ret->fcb = callback_new_1(callback_cast(vehicle_android_fix_callback), ret); ret->have_coords = 0; + ret->sats = 0; + ret->sats_used = 0; *meth = vehicle_android_methods; vehicle_android_init(ret); dbg(0, "return\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |