diff options
author | Pierre GRANDIN <pgrandin@users.noreply.github.com> | 2017-12-03 05:01:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-03 05:01:25 -0800 |
commit | 68cc6c392a6e83b9850aad6689d447f699cd5525 (patch) | |
tree | 3b89e3e1678b6d50a115fad1a822100d70fdc585 | |
parent | 8673e379042cc32f17af4d9aa5b424397af74c35 (diff) | |
parent | 3f9baceac03c592015d1609b29da7669687dab63 (diff) | |
download | navit-68cc6c392a6e83b9850aad6689d447f699cd5525.tar.gz |
Merge branch 'trunk' into distance_set_last.return
30 files changed, 749 insertions, 362 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..bd2cdf1c1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,110 @@ +# Change Log +All notable changes to this project will be documented in this file. + +Changes and documentation about Navit can be found in the wiki at: + http://wiki.navit-project.org +A timeline of opened and closed issue tickets can be found at our trac instance: + http://trac.navit-project.org + +Navit follows the semantic versioning: +* `x.y.Z` (patch): only bug fixes or refactoring, no changes in functionality +* `x.Y.z` (minor): added or changed functionality but can be used as a drop-in + replacement for the previous version (all data formats and interfaces are still + supported); minor UI changes (such as moving individual menu items) are also + allowed +* X.y.z (major): at least one of the following: + * Major new functionality (such as Augmented Reality, inertial navigation or + support for live traffic services): de-facto standard for end-user apps + * New user interface (such as moving from the old pulldown menu UI to the Internal + GUI): this is definitely the UI equivalent of a breaking API change + * Dropped support for a data format or interface: also a breaking change and + usually tends to occur along with larger changes which would warrant a new major + version anyway + +## [Unreleased] + +The list of changes that happened between the release 0.5.0 and the creation of +this changelog is too long to fit there so only a subset has been put here. + +For the full list of changes, see [Github full commit list](https://github.com/navit-gps/navit/compare/v0.5.0...HEAD) + + +### Added +- core: Allow zipcode or town seamless search (#211) +- core: Add feature poly_reservoir (#251) +- core: Add grass, grassland, wetland and sand (#247) +- core: Add poly_basin (#248) +- gui_internal: Add auto zoom toggle to gui_internal (#237) +- gui_internal: Add network info menu in gui/internal for Linux (#228) +- graphics: RaspberryPI hardware accelerated graphics support (#208) +- graphics: Add Qt5 support +- graphics: add multiple icons +- gtk: Add menu entry to toggle vehicle tracking (#362) +- espeak: Add speech module using espeak on QMultimedia. (#233) +- contrib/sailfish: Add rules to build sailfish package (#221) +- contrib/sailfish: Add autozoom switch to sailfosh config (#238) +- contrib/sailfish: Add desktop icons in sizes required by Sailfish OS. (#220) +- install: Allow unusual building (#215) +- doc: Improved follow vehicle toggle doc function for GTK (#363) +- doc: Added download links for PlayStore and F-Droid in the README +- ci: Added automatic publishing to Playstore Beta + +### Changed + +- core: Removed autotools lefotover (#204) +- core: sunrise near poles simplification (#206) +- core: keep active vehicle profile when deactivating vehicle (#217) +- core: Hide impossible keys at the internal keyboard instead of highlighting the possible ones (leftover from PR5) (#210) +- core: Reduce POST_SHIFT to avoid int overflow +- core: Remove dependency on OpenSSL +- port/android: ask permissions on sdk >= 23 +- i18n: Update of about all the translations available for the software +- ci: Updated the CI builds and tests +- ci: update zlib to 1.2.11 +- doc: Added some usage images to the README.md + +### Fixed +- port/android:moved Taiwan into its own map download entry #348 +- maptool:Remove option -5 (MD5 checksum) from maptool +- gtk: fixed missing imperial units in the GTK ui (#359) +- core: Remove binfile map encryption support +- core: Fix iPhone build broken by plugin refactoring +- core: Fix Car layout issues with wood and water (#240) +- core: TRAC-1246: Draw background color even if text label is empty. (#234) +- core: TRAC-981: Add Align-Attr to osd type Odometer (#230) +- core: navigation_analyze_roundabout : central_angle may lead to division by 0 (#218) +- core: Fix POI toggle bug with Car-dark layout (#223) +- core: TRAC-1347 Add 'Follow' and 'Active' to vehicle_demo to remove the corresponding error messages (Unsupported Attribute) (#229) +- gui_internal: Rename new option to hide_impossible_next_keys +- gui_internal: Don't crash if LANG environment not set (#232) +- xml:Change colors for wetland in Car and Car-dark (#257) +- port/android: Fix "invalid DT_NEEDED" warnings on API 23+, fixes #1348 (#205) +- port/android: Fix apk signing and bump sdk to 25 - nougat (#209) +- port/android: Fix #1345 crash on Android +- port/android: TRAC-1071 'Toggle POIs' button also toggle POI labels (#226) +- ci: Tomtom:Switching to mirrored toolchain + +### Removed + +## [0.5.0] - 2015-12-31 + +This release was done before the adoption of this changelog format. Click +[here](https://github.com/navit-gps/navit/compare/v0.5.0-rc.2...v0.5.0) +to view the corresponding changes. + +## [0.5.0-rc2] - 2015-09-02 + +This release was done before the adoption of this changelog format. Click +[here](https://github.com/navit-gps/navit/compare/v0.5.0-rc.1...v0.5.0-rc.2) +to view the corresponding changes. + +## [0.5.0-rc1] - 2015-08-08 + +This release was done before the adoption of this changelog format. Click +[here](https://github.com/navit-gps/navit/compare/v0.5.0-beta.1...v0.5.0-rc.1) +to view the corresponding changes. + +[Unreleased]: https://github.com/navit-gps/navit/compare/v0.5.0...HEAD +[0.5.0]: https://github.com/navit-gps/navit/compare/v0.5.0-rc.2...v0.5.0 +[0.5.0-rc.2]: https://github.com/navit-gps/navit/compare/v0.5.0-rc.1...v0.5.0-rc.2 +[0.5.0-rc.1]: https://github.com/navit-gps/navit/compare/v0.5.0-beta.1...v0.5.0-rc.1 diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 411115f00..000000000 --- a/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -Changes and documentation about Navit can be found in the wiki at: - http://wiki.navit-project.org -A timeline of opened and closed issue tickets can be found at our trac instance: - http://trac.navit-project.org diff --git a/cmake/copy_files.cmake b/cmake/copy_files.cmake index f9dca52f6..03ad8d14f 100644 --- a/cmake/copy_files.cmake +++ b/cmake/copy_files.cmake @@ -7,9 +7,10 @@ if ( SRC_FILES ) if ( LOWER ) get_filename_component(FILEN_NAME ${FILE} NAME) string(TOLOWER ${FILEN_NAME} FILEN_NAME_LOWER) - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST}/${FILEN_NAME_LOWER}) + file(COPY ${FILE} DESTINATION ${DST}/) + file(RENAME ${DST}/${FILEN_NAME} ${DST}/${FILEN_NAME_LOWER}) else() - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST}/) + file(COPY ${FILE} DESTINATION ${DST}) endif( LOWER ) endforeach() endif() diff --git a/navit/CMakeLists.txt b/navit/CMakeLists.txt index cac127531..2c1006b94 100644 --- a/navit/CMakeLists.txt +++ b/navit/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories( "${CMAKE_CURRENT_SOURCE_DIR}") include_directories( "${CMAKE_CURRENT_BINARY_DIR}") include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/support") -# navit cre +# navit core set(NAVIT_SRC announcement.c atom.c attr.c cache.c callback.c command.c config_.c coord.c country.c data_window.c debug.c event.c file.c geom.c graphics.c gui.c item.c layout.c log.c main.c map.c maps.c linguistics.c mapset.c maptype.c menu.c messages.c bookmarks.c navit.c navit_nls.c navigation.c osd.c param.c phrase.c plugin.c popup.c @@ -12,7 +12,7 @@ set(NAVIT_SRC announcement.c atom.c attr.c cache.c callback.c command.c config_. search_houseno_interpol.c util.c vehicle.c vehicleprofile.c xmlconfig.c ) if(NOT USE_PLUGINS) - list(APPEND NAVIT_SRC ${CMAKE_CURRENT_BINARY_DIR}/builtin.c) + list(APPEND NAVIT_SRC ${CMAKE_CURRENT_BINARY_DIR}/builtin.c) endif(NOT USE_PLUGINS) if (${HAVE_GLIB}) @@ -82,7 +82,7 @@ if(NOT ANDROID) add_executable(navit ${NAVIT_START_SRC}) target_link_libraries (navit ${NAVIT_LIBNAME}) if(DEFINED NAVIT_BINARY) - set_target_properties(navit PROPERTIES OUTPUT_NAME ${NAVIT_BINARY}) + set_target_properties(navit PROPERTIES OUTPUT_NAME ${NAVIT_BINARY}) endif(DEFINED NAVIT_BINARY) if (BUILD_BUNDLE) add_custom_command(OUTPUT resources/share COMMAND mkdir -p resources/share) @@ -96,12 +96,12 @@ if(NOT ANDROID) endif() if (SHARED_LIBNAVIT) - add_library (${NAVIT_LIBNAME} SHARED ${NAVIT_SRC} ) + add_library (${NAVIT_LIBNAME} SHARED ${NAVIT_SRC} ) else(SHARED_LIBNAVIT) - add_library (${NAVIT_LIBNAME} STATIC ${NAVIT_SRC} ) + add_library (${NAVIT_LIBNAME} STATIC ${NAVIT_SRC} ) endif(SHARED_LIBNAVIT) if(NOT MSVC) - SET(NAVIT_LIBS ${NAVIT_LIBS} m) + SET(NAVIT_LIBS ${NAVIT_LIBS} m) endif(NOT MSVC) target_link_libraries(${NAVIT_LIBNAME} ${MODULES_NAME} ${NAVIT_SUPPORT_LIBS} fib ${NAVIT_LIBS} ) set_target_properties(${NAVIT_LIBNAME} PROPERTIES COMPILE_DEFINITIONS "MODULE=navit;LIBDIR=\"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}\";PREFIX=\"${CMAKE_INSTALL_PREFIX}\"") @@ -113,50 +113,59 @@ ADD_CUSTOM_TARGET( git_version ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/version.h.in -D DST=${CMAKE_CURRENT_BINARY_DIR}/version.h - -D NAME="GIT_VERSION" + -D NAME="GIT_VERSION" -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake ) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/navit.dtd" + COMMENT "Copy navit.dtd to ${CMAKE_CURRENT_BINARY_DIR}/navit.dtd" + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/navit/navit.dtd" "${CMAKE_CURRENT_BINARY_DIR}/navit.dtd" +) + # additional parameter are passed to the stylesheet processor as parameter macro(process_xslt SRC_XML DEST_XML) - set(XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy ${SRC_XML} ${DEST_XML} - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/navit/navit.dtd ${CMAKE_CURRENT_BINARY_DIR}/navit.dtd) - if(XSL_PROCESSING AND XSLTS) - string(REPLACE "," ";" XSLTS "${XSLTS}") - foreach(tmp ${XSLTS}) - set(XSLT_FILE "${PROJECT_SOURCE_DIR}/navit/xslt/${tmp}.xslt") - list(APPEND XSLT_FILES "${XSLT_FILE}") - list(APPEND XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E echo Applying ${tmp}.xslt) - compose_xslt_transform_command(CMD "${XSLT_FILE}" "${DEST_XML}" "${DEST_XML}.tmp" "${ARGN}") - list(APPEND XSLT_COMMANDS ${CMD}) - list(APPEND XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E rename ${DEST_XML}.tmp ${DEST_XML}) - endforeach() - endif() + set(XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/navit/navit_shipped.xml" "${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML}" ) + if(XSL_PROCESSING) + if(NOT XSLTS STREQUAL "") + string(REPLACE "," ";" XSLTS "${XSLTS}") + foreach(tmp ${XSLTS}) + set(XSLT_FILE "${PROJECT_SOURCE_DIR}/navit/xslt/${tmp}.xslt") + list(APPEND XSLT_FILES "${XSLT_FILE}") + list(APPEND XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E echo Applying ${tmp}.xslt) + compose_xslt_transform_command(CMD "${XSLT_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML}" "${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML}.tmp" "${ARGN}") + list(APPEND XSLT_COMMANDS ${CMD}) + list(APPEND XSLT_COMMANDS COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML}.tmp" ${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML}) + endforeach() + endif() + endif(XSL_PROCESSING) # Depend on all XSLT files, because the main XSLT file may pull in other files. # Ideally we'd parse the main XSLT file for includes, but that is tricky to do reliably. # Note that this list of files is only updated when (re)running CMake, so if files are # added/deleted, CMake must be re-run manually. file(GLOB ALL_XSLT_FILES "${PROJECT_SOURCE_DIR}/navit/xslt/*.xslt") + #message(FATAL_ERROR ${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML}) ADD_CUSTOM_COMMAND( - OUTPUT ${DEST_XML} - DEPENDS ${SRC_XML} ${ALL_XSLT_FILES} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DEST_XML} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/navit/xslt/ + DEPENDS ${SRC_XML} "${CMAKE_CURRENT_BINARY_DIR}/navit.dtd" ${ALL_XSLT_FILES} ${XSLT_COMMANDS} ) endmacro() if(ANDROID) - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navitxxxhdpi.xml OSD_SIZE=5.33 ICON_SMALL=128 ICON_MEDIUM=192 ICON_BIG=256) - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navitxxhdpi.xml OSD_SIZE=4 ICON_SMALL=96 ICON_MEDIUM=128 ICON_BIG=192) - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navitxhdpi.xml OSD_SIZE=2.67 ICON_SMALL=64 ICON_MEDIUM=96 ICON_BIG=128) - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navithdpi.xml OSD_SIZE=2 ICON_SMALL=48 ICON_MEDIUM=64 ICON_BIG=96) - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navitmdpi.xml OSD_SIZE=1.33 ICON_SMALL=32 ICON_MEDIUM=48 ICON_BIG=64) - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navitldpi.xml OSD_SIZE=1 ICON_SMALL=24 ICON_MEDIUM=32 ICON_BIG=48) + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navitxxxhdpi.xml OSD_SIZE=5.33 ICON_SMALL=128 ICON_MEDIUM=192 ICON_BIG=256) + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navitxxhdpi.xml OSD_SIZE=4 ICON_SMALL=96 ICON_MEDIUM=128 ICON_BIG=192) + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navitxhdpi.xml OSD_SIZE=2.67 ICON_SMALL=64 ICON_MEDIUM=96 ICON_BIG=128) + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navithdpi.xml OSD_SIZE=2 ICON_SMALL=48 ICON_MEDIUM=64 ICON_BIG=96) + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navitmdpi.xml OSD_SIZE=1.33 ICON_SMALL=32 ICON_MEDIUM=48 ICON_BIG=64) + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navitldpi.xml OSD_SIZE=1 ICON_SMALL=24 ICON_MEDIUM=32 ICON_BIG=48) add_custom_target( navit_config_xml ALL DEPENDS navitxxxhdpi.xml navitxxhdpi.xml navitxhdpi.xml navithdpi.xml navitmdpi.xml navitldpi.xml) else() - process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml ${CMAKE_CURRENT_BINARY_DIR}/navit.xml "") + process_xslt(${CMAKE_CURRENT_SOURCE_DIR}/navit_shipped.xml navit.xml "") add_custom_target( navit_config_xml_resource DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/navit.xml COMMAND mkdir -p resources/share/navit COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/navit.xml resources/share/navit) add_custom_target( locale_resource DEPENDS locales COMMAND mkdir -p resources/share COMMAND cp -a ${CMAKE_CURRENT_BINARY_DIR}/../locale resources/share/locale) - add_custom_target( navit_config_xml ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/navit.xml) + add_custom_target( navit_config_xml ALL DEPENDS navit.xml) endif() ADD_DEPENDENCIES(${NAVIT_LIBNAME} git_version) @@ -182,17 +191,17 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/navit.xml get_directory_property(INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES) WRITE_FILE("cmake_plugin_settings.txt" - "set(APPLE ${APPLE} CACHE BOOL init)\n" - "set(ANDROID ${ANDROID} CACHE BOOL init)\n" - "set(USE_PLUGINS ${USE_PLUGINS} CACHE BOOL init)\n" - "set(MODULE_BUILD_TYPE \"${MODULE_BUILD_TYPE}\" CACHE STRING init)\n" - "set(NAVIT_COMPILE_FLAGS \"${NAVIT_COMPILE_FLAGS}\" CACHE STRING init)\n" - "set(navit_SOURCE_DIR \"${navit_SOURCE_DIR}\" CACHE STRING init)\n" - "set(NAVIT_LIBNAME \"${NAVIT_LIBNAME}\" CACHE STRING init)\n" - "set(ANDROID_API_VERSION \"${ANDROID_API_VERSION}\" CACHE STRING init)\n" - "set(ANDROID_NDK_API_VERSION \"${ANDROID_NDK_API_VERSION}\" CACHE STRING init)\n" - "set(CMAKE_TOOLCHAIN_FILE \"${CMAKE_TOOLCHAIN_FILE}\" CACHE STRING init)\n" - "set(INCLUDE_DIRECTORIES \"${INCLUDE_DIRECTORIES}\" CACHE STRING init)\n" - "set(LIB_DIR \"${LIB_DIR}\" CACHE STRING init)\n" - "set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\" CACHE STRING init)\n" - ) + "set(APPLE ${APPLE} CACHE BOOL init)\n" + "set(ANDROID ${ANDROID} CACHE BOOL init)\n" + "set(USE_PLUGINS ${USE_PLUGINS} CACHE BOOL init)\n" + "set(MODULE_BUILD_TYPE \"${MODULE_BUILD_TYPE}\" CACHE STRING init)\n" + "set(NAVIT_COMPILE_FLAGS \"${NAVIT_COMPILE_FLAGS}\" CACHE STRING init)\n" + "set(navit_SOURCE_DIR \"${navit_SOURCE_DIR}\" CACHE STRING init)\n" + "set(NAVIT_LIBNAME \"${NAVIT_LIBNAME}\" CACHE STRING init)\n" + "set(ANDROID_API_VERSION \"${ANDROID_API_VERSION}\" CACHE STRING init)\n" + "set(ANDROID_NDK_API_VERSION \"${ANDROID_NDK_API_VERSION}\" CACHE STRING init)\n" + "set(CMAKE_TOOLCHAIN_FILE \"${CMAKE_TOOLCHAIN_FILE}\" CACHE STRING init)\n" + "set(INCLUDE_DIRECTORIES \"${INCLUDE_DIRECTORIES}\" CACHE STRING init)\n" + "set(LIB_DIR \"${LIB_DIR}\" CACHE STRING init)\n" + "set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\" CACHE STRING init)\n" +) diff --git a/navit/Doxyfile b/navit/Doxyfile index 0960da8b9..6b3bc777a 100644 --- a/navit/Doxyfile +++ b/navit/Doxyfile @@ -809,7 +809,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = */support/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -1504,7 +1504,7 @@ MATHJAX_CODEFILE = # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. -SEARCHENGINE = NO +SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. There diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java index d3b970e98..7505e7ff7 100644 --- a/navit/android/src/org/navitproject/navit/Navit.java +++ b/navit/android/src/org/navitproject/navit/Navit.java @@ -80,6 +80,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import android.support.v4.app.NotificationCompat;
public class Navit extends Activity
@@ -119,6 +120,7 @@ public class Navit extends Activity public static final String NAVIT_PREFS = "NavitPrefs";
Boolean isFullscreen = false;
private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
+ public static NotificationManager nm;
/**
@@ -292,13 +294,17 @@ public class Navit extends Activity // NOTIFICATION
// Setup the status bar notification
// This notification is removed in the exit() function
- NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
- Notification NavitNotification = new Notification(R.drawable.ic_notify, getString(R.string.notification_ticker), System.currentTimeMillis()); // Create a new notification, with the text string to show when the notification first appears
+ nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
- //FIXME : needs a fix for sdk 23
- //NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent); // Set the text in the notification
- //NavitNotification.flags|=Notification.FLAG_ONGOING_EVENT; // Ensure that the notification appears in Ongoing
- nm.notify(R.string.app_name, NavitNotification); // Set the notification
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
+ builder.setContentIntent(appIntent);
+ builder.setAutoCancel(false).setOngoing(true);
+ builder.setContentTitle(getString(R.string.app_name));
+ builder.setContentText(getString(R.string.notification_event_default));
+ builder.setSmallIcon(R.drawable.ic_notify);
+ Notification NavitNotification = builder.build();
+ nm.notify(R.string.app_name, NavitNotification);// Show the notification
// Status and navigation bar sizes
// These are platform defaults and do not change with rotation, but we have to figure out which ones apply
@@ -906,8 +912,7 @@ public class Navit extends Activity public void exit()
{
-// NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-// nm.cancel(R.string.app_name);
+ nm.cancelAll();
NavitVehicle.removeListener();
NavitDestroy();
}
diff --git a/navit/gui/gtk/gui_gtk_statusbar.c b/navit/gui/gtk/gui_gtk_statusbar.c index 5497f9a9c..6e5c9980d 100644 --- a/navit/gui/gtk/gui_gtk_statusbar.c +++ b/navit/gui/gtk/gui_gtk_statusbar.c @@ -87,7 +87,7 @@ statusbar_route_update(struct statusbar_priv *this, struct navit *navit, struct struct map_rect *mr=NULL; struct item *item=NULL; struct attr attr; - double route_len=0; + double route_len=0; /* Distance to destination. We get it in kilometers. */ time_t eta; struct tm *eta_tm=NULL; char buffer[128]; diff --git a/navit/icons/communication.svg b/navit/icons/communication.svg index bad45d89a..35596b3c7 100644 --- a/navit/icons/communication.svg +++ b/navit/icons/communication.svg @@ -9,14 +9,17 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - height="22" + height="200" id="svg2" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" sodipodi:docname="communication.svg" sodipodi:version="0.32" version="1.0" - width="22"> + width="200" + inkscape:export-filename="C:\Users\jeremy\Pictures\svg\communication.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> <defs id="defs22"> <inkscape:perspective @@ -49,7 +52,7 @@ guidetolerance="10.0" id="base" inkscape:current-layer="svg2" - inkscape:cx="14.450743" + inkscape:cx="9.6858801" inkscape:cy="12.141264" inkscape:pageopacity="0.0" inkscape:pageshadow="2" @@ -57,7 +60,7 @@ inkscape:window-width="1366" inkscape:window-x="-8" inkscape:window-y="-8" - inkscape:zoom="17.57188" + inkscape:zoom="1" objecttolerance="10.0" pagecolor="#ffffff" showgrid="false" @@ -66,16 +69,16 @@ inkscape:measure-end="0,0" /> <g id="g1327" - transform="matrix(0.04083073,0,0,0.04083073,-0.1767767,-1.0602338)"> + transform="matrix(0.34431731,0,0,0.34431731,-0.1767767,0.6565548)"> <path - d="M 66.275,1.768 C 24.94,1.768 1.704,23.139 1.704,66.804 l 0,450.123 c 0,40.844 20.894,62.229 62.192,62.229 l 452.024,0 c 41.307,0 62.229,-20.316 62.229,-62.229 l 0,-450.123 c 0,-42.601 -20.922,-65.036 -63.522,-65.036 -0.003,0 -448.494,-0.143 -448.352,0 z" + d="M 66.275,1.768 C 24.94,1.768 1.704,23.139 1.704,66.804 v 450.123 c 0,40.844 20.894,62.229 62.192,62.229 H 515.92 c 41.307,0 62.229,-20.316 62.229,-62.229 V 66.804 c 0,-42.601 -20.922,-65.036 -63.522,-65.036 -0.003,0 -448.494,-0.143 -448.352,0 z" id="path1329" style="fill:#111111;fill-opacity:0;stroke:#eeeeee;stroke-width:3.40799999;stroke-opacity:0" inkscape:connector-curvature="0" /> </g> <g id="g2319" - transform="matrix(0.04083073,0,0,0.04083073,35.725326,0.442546)"> + transform="matrix(0.04083073,0,0,0.04083073,35.725326,178.44255)"> <path d="" id="path2323" @@ -84,7 +87,7 @@ </g> <g id="g2325" - transform="matrix(0.04083073,0,0,0.04083073,35.725326,0.442546)"> + transform="matrix(0.04083073,0,0,0.04083073,35.725326,178.44255)"> <path d="" id="path2329" @@ -92,39 +95,39 @@ inkscape:connector-curvature="0" /> </g> <circle - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:2.10489988;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:19.34242439;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path898" - cx="7.4564438" - cy="6.1999226" - r="2.5702684" /> + cx="70.480728" + cy="55.175976" + r="23.618807" /> <path - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:1.2851342px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 1.7888865,21.595802 C 1.7472225,18.024565 2.7605344,9.5386167 5.2788818,9.3760639 c 1.9139241,-0.076555 2.6380187,-0.132203 4.1544689,0 2.1751583,0.1782276 3.9757453,7.8313611 3.9921953,12.2197371 h -1.607697 c -0.229376,-3.388486 -0.611612,-5.480113 -1.301468,-7.693975 -0.153114,1.071798 -0.229671,7.693976 -0.229671,7.693976 H 4.9277222 L 4.6214943,13.901826 c -1.1217852,2.785041 -1.3214048,5.746992 -1.3014684,7.770533 z" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:11.80940342px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 18.400196,196.65238 C 18.017335,163.8354 27.328899,85.85608 50.470592,84.362277 c 17.587504,-0.702977 24.241381,-1.214817 38.176402,0 19.988056,1.637799 36.534076,71.964233 36.685236,112.290103 h -14.77352 c -2.10778,-31.13765 -5.62024,-50.35805 -11.959493,-70.70173 -1.407001,9.84894 -2.110502,70.70173 -2.110502,70.70173 H 47.243703 l -2.814001,-70.70173 c -10.308351,25.5924 -12.142703,52.81047 -11.959503,71.40525 z" id="path900" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccccccc" /> <path - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:1.2851342px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="m 10.036017,7.7333484 c 0.706308,0.4985691 2.617492,-1.4126154 3.406895,-1.3710679 0.789403,0.041547 4.071655,0.9971401 5.027247,-0.1661899 C 19.425753,5.0327605 19.010277,1.2103904 17.680758,0.91955782 16.351238,0.62872539 10.243755,-0.32686724 9.4959004,1.7920554 8.7480459,3.910978 11.240895,5.3651405 11.656369,5.5313305 11.781013,6.320733 10.036017,7.7333484 10.036017,7.7333484 Z" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:11.80940342px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 94.185039,69.267024 c 6.490431,4.581479 24.052751,-12.9809 31.306761,-12.599087 7.25402,0.382272 37.41541,9.162956 46.19657,-1.527159 8.78119,-10.690116 4.96328,-45.8147836 -7.254,-48.4872889 -12.21726,-2.6725063 -68.340379,-11.453742 -75.212592,8.0176089 -6.872212,19.47126 16.035162,32.833882 19.853062,34.361041 1.14538,7.253985 -14.889801,20.234885 -14.889801,20.234885 z" id="path902" inkscape:connector-curvature="0" sodipodi:nodetypes="csssscc" /> <circle - style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:0.50433594;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:4.63446236;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path904" - cx="12.427114" - cy="3.3160748" - r="0.24783203" /> + cx="116.1574" + cy="28.675596" + r="2.2773874" /> <circle - style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:0.50433594;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:4.63446236;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path904-5" - cx="14.454914" - cy="3.3160748" - r="0.24783203" /> + cx="134.79134" + cy="28.675596" + r="2.2773874" /> <circle - style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:0.50433594;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:4.63446236;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path904-5-5" - cx="16.446732" - cy="3.3160748" - r="0.24783203" /> + cx="153.09462" + cy="28.675596" + r="2.2773874" /> </svg> diff --git a/navit/icons/concert.svg b/navit/icons/concert.svg index d226e4c2d..c908b056f 100644 --- a/navit/icons/concert.svg +++ b/navit/icons/concert.svg @@ -9,14 +9,17 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - height="22" + height="200" id="svg2" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" sodipodi:docname="concert.svg" sodipodi:version="0.32" version="1.0" - width="22"> + width="200" + inkscape:export-filename="C:\Users\jeremy\Pictures\svg\concert.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> <defs id="defs22"> <inkscape:perspective @@ -49,7 +52,7 @@ guidetolerance="10.0" id="base" inkscape:current-layer="svg2" - inkscape:cx="20.75586" + inkscape:cx="14.153144" inkscape:cy="4.6274553" inkscape:pageopacity="0.0" inkscape:pageshadow="2" @@ -57,7 +60,7 @@ inkscape:window-width="1366" inkscape:window-x="-8" inkscape:window-y="-8" - inkscape:zoom="12.680782" + inkscape:zoom="1" objecttolerance="10.0" pagecolor="#ffffff" showgrid="false" @@ -67,16 +70,16 @@ inkscape:lockguides="true" /> <g id="g1327" - transform="matrix(0.04083073,0,0,0.04083073,-0.1767767,-1.0602338)"> + transform="matrix(0.34431731,0,0,0.34431731,-0.1767767,0.6565548)"> <path - d="M 66.275,1.768 C 24.94,1.768 1.704,23.139 1.704,66.804 l 0,450.123 c 0,40.844 20.894,62.229 62.192,62.229 l 452.024,0 c 41.307,0 62.229,-20.316 62.229,-62.229 l 0,-450.123 c 0,-42.601 -20.922,-65.036 -63.522,-65.036 -0.003,0 -448.494,-0.143 -448.352,0 z" + d="M 66.275,1.768 C 24.94,1.768 1.704,23.139 1.704,66.804 v 450.123 c 0,40.844 20.894,62.229 62.192,62.229 H 515.92 c 41.307,0 62.229,-20.316 62.229,-62.229 V 66.804 c 0,-42.601 -20.922,-65.036 -63.522,-65.036 -0.003,0 -448.494,-0.143 -448.352,0 z" id="path1329" style="fill:#111111;fill-opacity:0;stroke:#eeeeee;stroke-width:3.40799999;stroke-opacity:0" inkscape:connector-curvature="0" /> </g> <g id="g2319" - transform="matrix(0.04083073,0,0,0.04083073,35.725326,0.442546)"> + transform="matrix(0.04083073,0,0,0.04083073,35.725326,178.44255)"> <path d="" id="path2323" @@ -85,62 +88,42 @@ </g> <g id="g2325" - transform="matrix(0.04083073,0,0,0.04083073,35.725326,0.442546)"> + transform="matrix(0.04083073,0,0,0.04083073,35.725326,178.44255)"> <path d="" id="path2329" style="fill:#0089cd;stroke:none" inkscape:connector-curvature="0" /> </g> - <path - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:1.16406763px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 11.89298,0.29824419 C 6.7920335,0.36448969 3.0245422,3.9744881 3.0160085,9.208339 c -0.00777,4.764226 8.8769715,12.089905 8.8769715,12.089905 0,0 8.399996,-7.12183 8.41325,-12.089905 C 20.3186,4.5706582 16.993926,0.29824419 11.89298,0.29824419 Z" - id="path1492" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cscsc" /> - <path - style="fill:#0089cd;fill-opacity:1;stroke:#ffffff;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="M 11.875679,1.0590326 C 7.1553836,1.1203346 3.669036,4.4609421 3.6611391,9.3042242 3.6539491,13.712926 11.875679,20.491937 11.875679,20.491937 c 0,0 7.773159,-6.590374 7.785423,-11.1877128 0.01145,-4.2916004 -3.065128,-8.2451916 -7.785423,-8.2451916 z" - id="path1492-2" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cscsc" - inkscape:transform-center-x="-1.3165584" - inkscape:transform-center-y="3.1070785" /> - <circle - style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.25710332;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - id="path1494" - cx="11.661134" - cy="8.7982445" - r="7" /> <circle - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:0.50632137;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:9.95306969;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path1511" - cx="8.9422398" - cy="12.313624" - r="1.313432" /> + cx="54.465088" + cy="171.69257" + r="25.818937" /> <circle - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:0.50632137;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:9.95306969;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path1511-2" - cx="13.315376" - cy="10.128977" - r="1.313432" /> + cx="140.43051" + cy="128.74763" + r="25.818937" /> <rect - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:0.47141925;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:9.26697731;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="rect1530" - width="1.1041681" - height="5.7941589" - x="9.1515036" - y="6.3877821" /> + width="21.705309" + height="113.89934" + x="58.578712" + y="55.204674" /> <rect - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:0.47141925;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:9.26697731;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="rect1530-1" - width="1.1041681" - height="5.7941589" - x="13.52464" - y="4.2824731" /> + width="21.705309" + height="113.89934" + x="144.54413" + y="13.819176" /> <path - style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:1.75124252px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 9.1557652,6.3877811 14.628808,3.7072399 V 5.1514704 L 9.1557652,7.8504332 Z" + style="fill:#0089cd;fill-opacity:1;stroke:none;stroke-width:34.42524719px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 58.662477,55.204534 166.24943,2.511515 V 30.901629 L 58.662477,83.956741 Z" id="path1547" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" /> diff --git a/navit/map.h b/navit/map.h index 305c26b96..4ffe0d401 100644 --- a/navit/map.h +++ b/navit/map.h @@ -79,13 +79,13 @@ struct map_methods { struct map_rect_priv * (*map_rect_new)(struct map_priv *map, struct map_selection *sel); /**< Function to create a new map rect on the map. */ void (*map_rect_destroy)(struct map_rect_priv *mr); /**< Function to destroy a map rect */ struct item * (*map_rect_get_item)(struct map_rect_priv *mr); /**< Function to return the next item from a map rect */ - struct item * (*map_rect_get_item_byid)(struct map_rect_priv *mr, int id_hi, int id_lo); /**< Function to get an item with a specific ID from a map rect */ - struct map_search_priv *(*map_search_new)(struct map_priv *map, struct item *item, struct attr *search, int partial); /**< Function to start a new search on the map */ - void (*map_search_destroy)(struct map_search_priv *ms); /**< Function to destroy a map search struct */ - struct item * (*map_search_get_item)(struct map_search_priv *ms); /**< Function to get the next item of a search on the map */ + struct item * (*map_rect_get_item_byid)(struct map_rect_priv *mr, int id_hi, int id_lo); /**< Function to get an item with a specific ID from a map rect, can be NULL */ + struct map_search_priv *(*map_search_new)(struct map_priv *map, struct item *item, struct attr *search, int partial); /**< Function to start a new search on the map, can be NULL */ + void (*map_search_destroy)(struct map_search_priv *ms); /**< Function to destroy a map search struct, ignored if `map_search_new` is NULL */ + struct item * (*map_search_get_item)(struct map_search_priv *ms); /**< Function to get the next item of a search on the map, ignored if `map_search_new` is NULL */ struct item * (*map_rect_create_item)(struct map_rect_priv *mr, enum item_type type); /**< Function to create a new item in the map */ - int (*map_get_attr)(struct map_priv *priv, enum attr_type type, struct attr *attr); - int (*map_set_attr)(struct map_priv *priv, struct attr *attr); + int (*map_get_attr)(struct map_priv *priv, enum attr_type type, struct attr *attr); /**< Function to get a map attribute, can be NULL */ + int (*map_set_attr)(struct map_priv *priv, struct attr *attr); /**< Function to set a map attribute, can be NULL */ }; diff --git a/navit/navigation.c b/navit/navigation.c index ac6b5e834..0252730a4 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -1014,11 +1014,11 @@ round_distance_reduced( int dist ) * 'imperial' if set distinguishes the distance statement between miles and feet. Maximum distance in feet is 500. * 'vocabulary_distances' if set constrains the distance values to a set of simple pronounceable numbers. * -* @param nav The navigation object. -* @param dist Distance in meters. -* @param type The type of announcement precision. -* @param is_length 1 for length statement, 0 for distance statement. -* @return String with length/distance statement. +* @param nav The navigation object. +* @param dist_meters Distance in meters. +* @param type The type of announcement precision. +* @param is_length 1 for length statement, 0 for distance statement. +* @return String with length/distance statement. */ static char * get_distance_str(struct navigation *nav, int dist_meters, enum attr_type type, int is_length) @@ -1058,7 +1058,7 @@ get_distance_str(struct navigation *nav, int dist_meters, enum attr_type type, i return g_strdup_printf(_("in %d feet"), dist_feet); } - int dist_miles = (double) dist_meters / (double)METERS_PER_MILE + 0.5; + int dist_miles = (double) dist_meters * (double)METERS_TO_MILES + 0.5; if (vocabulary == 0) { @@ -1066,10 +1066,10 @@ get_distance_str(struct navigation *nav, int dist_meters, enum attr_type type, i dist_miles = round_distance_reduced(dist_miles); } - if ((dist_meters < METERS_PER_MILE) && (vocabulary > 0)) + if ((dist_meters < METERS_TO_MILES) && (vocabulary > 0)) { /* values smaller than one need extra treatment for one decimal place. For reduced vocabulary it shall remain 'one'. */ - int rem = (((double)dist_meters / (double)METERS_PER_MILE) + 0.05) * 10.0; + int rem = (((double)dist_meters * (double)METERS_TO_MILES) + 0.05) * 10.0; dist_miles= 0; if (is_length) return g_strdup_printf(_("%d.%d miles"), dist_miles, rem); diff --git a/navit/navigation.h b/navit/navigation.h index 789d4fcbf..0651dbc79 100644 --- a/navit/navigation.h +++ b/navit/navigation.h @@ -23,8 +23,16 @@ #define FEET_PER_METER 3.2808399 #define FEET_PER_MILE 5280 #define KILOMETERS_TO_MILES 0.62137119 /* Kilometers to miles */ -#define METERS_PER_MILE 1/(KILOMETERS_TO_MILES/1000.00) -#define MPS_TO_KPH 3.6 /* Meters per second to klicks/hr */ + +/* It appears that distances to be displayed, such as distances to + * maneuvers, are in meters. Multiply that by METERS_PER_MILE and you + * have miles. */ +#define METERS_TO_MILES (KILOMETERS_TO_MILES/1000.0) /* Meters to miles */ +/* #define METERS_PER_MILE (1000.0/KILOMETERS_TO_MILES) */ + +/* Meters per second to kilometers per hour. GPSD delivers speeds in + * meters per second. */ +#define MPS_TO_KPH 3.6 #ifdef __cplusplus extern "C" { diff --git a/navit/navit.c b/navit/navit.c index 768fb7d3b..a32de161e 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -1975,14 +1975,15 @@ navit_window_roadbook_update(struct navit *this_) param[0].value=_("Position"); param[0].name=_("Command"); + /* Distance to the next maneuver. */ item_attr_get(item, attr_length, &attr); - dbg(lvl_info, "Length=%ld\n", attr.u.num); + dbg(lvl_info, "Length=%ld in meters\n", attr.u.num); param[1].name=_("Length"); if ( attr.u.num >= 2000 ) { param[1].value=g_strdup_printf("%5.1f %s", - imperial == TRUE ? (float)attr.u.num / (METERS_PER_MILE/1000.00) : (float)attr.u.num / 1000, + imperial == TRUE ? (float)attr.u.num * METERS_TO_MILES : (float)attr.u.num / 1000, imperial == TRUE ? _("mi") : _("km") ); } @@ -1994,6 +1995,7 @@ navit_window_roadbook_update(struct navit *this_) ); } + /* Time to next maneuver. */ item_attr_get(item, attr_time, &attr); dbg(lvl_info, "Time=%ld\n", attr.u.num); secs=attr.u.num/10; @@ -2007,13 +2009,14 @@ navit_window_roadbook_update(struct navit *this_) param[2].value=g_strdup_printf("%d:%02d",secs / 60, secs % 60); } + /* Distance from next maneuver to destination. */ item_attr_get(item, attr_destination_length, &attr); - dbg(lvl_info, "Destlength=%ld\n", attr.u.num); + dbg(lvl_info, "Destlength=%ld in meters.\n", attr.u.num); param[3].name=_("Destination Length"); if ( attr.u.num >= 2000 ) { param[3].value=g_strdup_printf("%5.1f %s", - imperial == TRUE ? (float)attr.u.num / METERS_PER_MILE : (float)attr.u.num / 1000, + imperial == TRUE ? (float)attr.u.num * METERS_TO_MILES : (float)attr.u.num / 1000, imperial == TRUE ? _("mi") : _("km") ); } @@ -2025,6 +2028,7 @@ navit_window_roadbook_update(struct navit *this_) ); } + /* Time from next maneuver to destination. */ item_attr_get(item, attr_destination_time, &attr); dbg(lvl_info, "Desttime=%ld\n", attr.u.num); secs=attr.u.num/10; diff --git a/navit/plugin.c b/navit/plugin.c index 8c61bc9b7..aae09c470 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -38,6 +38,13 @@ #include "item.h" #include "debug.h" +/** + * @defgroup plugins + * @brief A interface to handle all plugins inside navit + * + * @{ + */ + #ifdef USE_PLUGINS #ifndef HAVE_GMODULE typedef void * GModule; diff --git a/navit/route.c b/navit/route.c index 2251ffb7f..c67455902 100644 --- a/navit/route.c +++ b/navit/route.c @@ -250,8 +250,8 @@ struct route { struct route_graph *graph; /**< Pointer to the route graph */ struct route_path *path2; /**< Pointer to the route path */ - struct map *map; - struct map *graph_map; + struct map *map; /**< The map containing the route path */ + struct map *graph_map; /**< The map containing the route graph */ struct callback * route_graph_done_cb ; /**< Callback when route graph is done */ struct callback * route_graph_flood_done_cb ; /**< Callback when route graph flooding is done */ struct callback_list *cbl2; /**< Callback list to call when route changes */ diff --git a/navit/transform.c b/navit/transform.c index 1c6eeae67..8a6713ab6 100644 --- a/navit/transform.c +++ b/navit/transform.c @@ -1187,6 +1187,14 @@ transform_overflow_possible_if_squared(int count, ...) { return result; } +/** + * @brief Determines the squared Mercator distance between two points. + * + * @param c0 The first coordinate + * @param c1 The second coordinate + * + * @return The squared distance between `c1` and `c2`, or `INT_MAX` if an overflow occurs. + */ int transform_distance_sq(struct coord *c1, struct coord *c2) { @@ -1216,6 +1224,17 @@ transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2) return transform_distance_sq(&p1, &p2); } +/** + * @brief Determines the point on a line segment that is closest to a reference point, and its distance + * from the reference point. + * + * @param l0 The first coordinate of the line segment + * @param l1 The second coordinate of the line segment + * @param ref The reference point + * @param lpnt Receives the coordinates of the point on the line segment that is closest to `ref`, can be `NULL` + * + * @return The square of the Mercator distance between `ref` and `lpnt`, or `INT_MAX` if an overflow occurred + */ int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt) { @@ -1287,6 +1306,18 @@ transform_distance_line_sq_float(struct coord *l0, struct coord *l1, struct coor return transform_distance_sq_float(&l, ref); } +/** + * @brief Determines the point on a polyline that is closest to a reference point, and its distance + * from the reference point. + * + * @param c An array containing the coordinates of the polyline + * @param count Number of elements in `c` + * @param ref The reference point + * @param lpnt Receives the coordinates of the point on the polyline that is closest to `ref`, can be `NULL` + * @param pos Receives the index of the line segment containing `lpnt`, can be NULL + * + * @return The square of the Mercator distance between `ref` and `lpnt`, or `INT_MAX` if an overflow occurred + */ int transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos) { diff --git a/navit/vehicle.c b/navit/vehicle.c index 33cecb0e9..26dc457cb 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -18,6 +18,8 @@ */ /** @file vehicle.c + * @defgroup vehicle-plugins vehicle plugins + * @ingroup plugins * @brief Generic components of the vehicle object. * * This file implements the generic vehicle interface, i.e. everything which is @@ -52,6 +54,7 @@ #include "vehicle.h" #include "navit_nls.h" + struct vehicle { NAVIT_OBJECT struct vehicle_methods meth; diff --git a/navit/vehicle/android/vehicle_android.c b/navit/vehicle/android/vehicle_android.c index 89882d048..4165b9b31 100644 --- a/navit/vehicle/android/vehicle_android.c +++ b/navit/vehicle/android/vehicle_android.c @@ -1,6 +1,4 @@ -/** @file vehicle_android.c - * @brief android uses dbus signals - * +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -18,8 +16,6 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * - * @Author Tim Niemeyer <reddog@mastersword.de> - * @date 2008-2009 */ #include <config.h> @@ -35,6 +31,15 @@ #include "android.h" #include "vehicle.h" +/** + * @defgroup vehicle-android Vehicle Android + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from android. Android uses dbus signals + * @author Tim Niemeyer <reddog@mastersword.de> + * @date 2008-2009 + * + */ + struct vehicle_priv { struct callback_list *cbl; struct coord_geo geo; /**< The last known position of the vehicle **/ @@ -294,3 +299,5 @@ plugin_init(void) dbg(lvl_debug, "enter\n"); plugin_register_category_vehicle("android", vehicle_android_new_android); } + +/** @} */ diff --git a/navit/vehicle/demo/vehicle_demo.c b/navit/vehicle/demo/vehicle_demo.c index 4a47c1476..1e2991300 100644 --- a/navit/vehicle/demo/vehicle_demo.c +++ b/navit/vehicle/demo/vehicle_demo.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -34,6 +34,13 @@ #include "event.h" #include "util.h" +/** + * @defgroup vehicle-demo Vehicle Demo + * @ingroup vehicle-plugins + * @brief The Vehicle for a demo. It followes the route automatically + * + */ + struct vehicle_priv { int interval; int position_set; @@ -302,3 +309,6 @@ plugin_init(void) dbg(lvl_debug, "enter\n"); plugin_register_category_vehicle("demo", vehicle_demo_new); } + + +/** @} */ diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c index 10bce942b..81b99f829 100644 --- a/navit/vehicle/file/vehicle_file.c +++ b/navit/vehicle/file/vehicle_file.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -59,6 +59,14 @@ int inet_aton(const char *cp, struct in_addr *inp) } #endif +/** + * @defgroup vehicle-file Vehicle File + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from a file, pipe, serial interface or a socket + * + * @{ + */ + static void vehicle_file_disable_watch(struct vehicle_priv *priv); static void vehicle_file_enable_watch(struct vehicle_priv *priv); static int vehicle_file_parse(struct vehicle_priv *priv, char *buffer); @@ -84,7 +92,7 @@ struct vehicle_priv { char *source; struct callback_list *cbl; int fd; - struct callback *cb,*cbt; + struct callback *cb,*cbt,*cb_fix_timeout; char *buffer; int buffer_pos; char *nmea_data; @@ -114,6 +122,7 @@ struct vehicle_priv { enum file_type file_type; FILE *file; struct event_watch *watch; + struct event_timeout *ev_fix_timeout; speed_t baudrate; struct attr ** attrs; char fixiso8601[128]; @@ -129,16 +138,13 @@ struct vehicle_priv { int process_statefile; }; -//*************************************************************************** -/** @fn static int vehicle_win32_serial_track(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: Callback of the plugin -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -* @return always 1 -***************************************************************************** -**/ +/** +* @brief Callback of the plugin +* +* @param priv Pointer on the private data of the plugin +* +* @return Always 1 +*/ #ifdef _WIN32 static int vehicle_win32_serial_track(struct vehicle_priv *priv) { @@ -207,17 +213,13 @@ static int vehicle_win32_serial_track(struct vehicle_priv *priv) } #endif -//*************************************************************************** -/** @fn static int vehicle_file_open(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: open dialogue with the GPS -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -* @return 1 if ok -* 0 if error -***************************************************************************** -**/ +/** +* @brief Open dialogue with the GPS +* +* @param priv Pointer on the private data of the plugin +* +* @return 1 if ok, 0 if error +*/ static int vehicle_file_open(struct vehicle_priv *priv) { @@ -318,14 +320,11 @@ vehicle_file_open(struct vehicle_priv *priv) return(priv->fd != -1); } -//*************************************************************************** -/** @fn static void vehicle_file_close(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: close dialogue with the GPS -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -**/ +/** +* @brief Close dialogue with the GPS +* +* @param priv Pointer on the private data of the plugin +*/ static void vehicle_file_close(struct vehicle_priv *priv) { @@ -356,16 +355,13 @@ vehicle_file_close(struct vehicle_priv *priv) } } -//*************************************************************************** -/** @fn static int vehicle_file_enable_watch_timer(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: Enable watch timer to get GPS data -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -* @return always 0 -***************************************************************************** -**/ +/** +* @brief Enable watch timer to get GPS data +* +* @param priv Pointer on the private data of the plugin +* +* @return Always 0 +*/ static int vehicle_file_enable_watch_timer(struct vehicle_priv *priv) { @@ -376,19 +372,44 @@ vehicle_file_enable_watch_timer(struct vehicle_priv *priv) } -//*************************************************************************** -/** @fn static int vehicle_file_parse( struct vehicle_priv *priv, -* char *buffer) -***************************************************************************** -* @b Description: Parse the buffer -***************************************************************************** -* @param priv : pointer on the private data of the plugin -* @param buffer : data buffer (null terminated) -***************************************************************************** -* @return 1 if The GPRMC Sentence is found -* 0 if not found -***************************************************************************** -**/ +/** +* @brief This is a callback function, called when the fix timeout +* is done. Set the position to invalid. +* +* @param priv Pointer on the private data of the plugin +*/ +static void +vehicle_file_fix_timeout_cb(struct vehicle_priv *priv) +{ + priv->valid = attr_position_valid_invalid; + priv->ev_fix_timeout = NULL; + callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); +} + + +/** +* @brief Cancel previous fix timeout event and add a new one +* +* @param priv Pointer on the private data of the plugin +*/ +static void +vehicle_file_restart_fix_timeout(struct vehicle_priv *priv) +{ + if (priv->ev_fix_timeout != NULL) + event_remove_timeout(priv->ev_fix_timeout); + priv->ev_fix_timeout = event_add_timeout(10000, 0, priv->cb_fix_timeout); +} + + +/** +* @brief Parse the buffer +* +* @param priv Pointer on the private data of the plugin +* @param buffer Data buffer (null terminated) +* +* @return 1 if new coords were received (fixtime changed) or changed to invalid, +* 0 if not found +*/ static int vehicle_file_parse(struct vehicle_priv *priv, char *buffer) { @@ -458,7 +479,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer) UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7], HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14] */ - if (*item[2] && *item[3] && *item[4] && *item[5]) { + if (*item[2] && *item[3] && *item[4] && *item[5] && *item[6] > 0) { lat = g_ascii_strtod(item[2], NULL); priv->geo.lat = floor(lat / 100); lat -= priv->geo.lat * 100; @@ -474,20 +495,31 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer) if (!g_ascii_strcasecmp(item[5],"W")) priv->geo.lng=-priv->geo.lng; - priv->valid=attr_position_valid_valid; + + if (priv->valid == attr_position_valid_invalid) + ret = 1; + priv->valid = attr_position_valid_valid; + vehicle_file_restart_fix_timeout(priv); + + if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) { + ret = 1; + strncpy(priv->fixtime, item[1], sizeof(priv->fixtime)); + } dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng); - } else + } else { + if (priv->valid == attr_position_valid_valid) + ret = 1; priv->valid=attr_position_valid_invalid; + } + if (*item[6]) sscanf(item[6], "%d", &priv->status); if (*item[7]) sscanf(item[7], "%d", &priv->sats_used); if (*item[8]) sscanf(item[8], "%lf", &priv->hdop); - if (*item[1]) - strncpy(priv->fixtime, item[1], sizeof(priv->fixtime)); if (*item[9]) sscanf(item[9], "%lf", &priv->height); @@ -537,8 +569,40 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer) &priv->fixmonth, &priv->fixyear); priv->fixyear += 2000; + + lat = g_ascii_strtod(item[3], NULL); + priv->geo.lat = floor(lat / 100); + lat -= priv->geo.lat * 100; + priv->geo.lat += lat / 60; + + if (!g_ascii_strcasecmp(item[4],"S")) + priv->geo.lat=-priv->geo.lat; + + lng = g_ascii_strtod(item[5], NULL); + priv->geo.lng = floor(lng / 100); + lng -= priv->geo.lng * 100; + priv->geo.lng += lng / 60; + + if (!g_ascii_strcasecmp(item[6],"W")) + priv->geo.lng=-priv->geo.lng; + + if (priv->valid == attr_position_valid_invalid) + ret = 1; + priv->valid=attr_position_valid_valid; + vehicle_file_restart_fix_timeout(priv); + + if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) { + ret = 1; + strncpy(priv->fixtime, item[1], sizeof(priv->fixtime)); + } + + dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng); + + } else { + if (priv->valid == attr_position_valid_valid) + ret = 1; + priv->valid=attr_position_valid_invalid; } - ret = 1; } if (!strncmp(buffer, "$GPGSV", 6) && i >= 4) { /* @@ -610,16 +674,11 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer) return ret; } -//*************************************************************************** -/** @fn static void vehicle_file_io(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: function to get data from GPS -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -* @remarks -***************************************************************************** -**/ +/** +* @brief Function to get data from GPS +* +* @param priv Pointer on the private data of the plugin +*/ static void vehicle_file_io(struct vehicle_priv *priv) { @@ -685,14 +744,11 @@ vehicle_file_io(struct vehicle_priv *priv) callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); } -//*************************************************************************** -/** @fn static void vehicle_file_enable_watch(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: Enable watch -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -**/ +/** +* @brief Enable watch +* +* @param priv Pointer on the private data of the plugin +*/ static void vehicle_file_enable_watch(struct vehicle_priv *priv) { @@ -713,14 +769,11 @@ vehicle_file_enable_watch(struct vehicle_priv *priv) } } -//*************************************************************************** -/** @fn static void vehicle_file_disable_watch(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: Disable watch -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** -**/ +/** +* @brief Disable watch +* +* @param priv Pointer on the private data of the plugin +*/ static void vehicle_file_disable_watch(struct vehicle_priv *priv) { @@ -742,16 +795,13 @@ vehicle_file_disable_watch(struct vehicle_priv *priv) } } -//*************************************************************************** -/** @fn static void vehicle_priv vehicle_file_destroy(struct vehicle_priv *priv) -***************************************************************************** -* @b Description: Function called to uninitialize the plugin -***************************************************************************** -* @param priv : pointer on the private data of the plugin -***************************************************************************** +/** +* @brief Function called to uninitialize the plugin +* +* @param priv Pointer on the private data of the plugin +* * @remarks private data is freed by this function (g_free) -***************************************************************************** -**/ +*/ static void vehicle_file_destroy(struct vehicle_priv *priv) { @@ -781,21 +831,15 @@ vehicle_file_destroy(struct vehicle_priv *priv) g_free(priv); } -//*************************************************************************** -/** @fn static int vehicle_file_position_attr_get(struct vehicle_priv *priv, -* enum attr_type type, -* struct attr *attr) -***************************************************************************** -* @b Description: Function called to get attribute -***************************************************************************** -* @param priv : pointer on the private data of the plugin -* @param type : attribute type called -* @param attr : structure to return the attribute value -***************************************************************************** -* @return 1 if ok -* 0 for unkown or invalid attribute -***************************************************************************** -**/ +/** +* @brief Function called to get attribute +* +* @param priv Pointer on the private data of the plugin +* @param type Attribute type called +* @param attr Structure to return the attribute value +* +* @return 1 if ok, 0 for unkown or invalid attribute +*/ static int vehicle_file_position_attr_get(struct vehicle_priv *priv, enum attr_type type, struct attr *attr) @@ -865,21 +909,15 @@ vehicle_file_position_attr_get(struct vehicle_priv *priv, return 1; } -//*************************************************************************** -/** @fn static int vehicle_file_sat_attr_get(struct vehicle_priv *priv, -* enum attr_type type, -* struct attr *attr) -***************************************************************************** -* @b Description: Function called to get satellite attribute -***************************************************************************** -* @param priv : pointer on the private data of the plugin -* @param type : attribute type called -* @param attr : structure to return the attribute value -***************************************************************************** -* @return 1 if ok -* 0 for unkown attribute -***************************************************************************** -**/ +/** +* @brief Function called to get satellite attribute +* +* @param priv Pointer on the private data of the plugin +* @param type Attribute type called +* @param attr Structure to return the attribute value +* +* @return 1 if ok, 0 for unkown attribute +*/ static int vehicle_file_sat_attr_get(void *priv_data, enum attr_type type, struct attr *attr) { @@ -922,23 +960,17 @@ static struct vehicle_methods vehicle_file_methods = { vehicle_file_position_attr_get, }; -//*************************************************************************** -/** @fn static struct vehicle_priv * vehicle_file_new_file( -* struct vehicle_methods *meth, -* struct callback_list *cbl, -* struct attr **attrs) -***************************************************************************** -* @b Description: Function called to initialize the plugin -***************************************************************************** -* @param meth : ? -* @param cbl : ? -* @param attrs : ? -***************************************************************************** -* @return pointer on the private data of the plugin -***************************************************************************** -* @remarks private data is allocated by this function (g_new0) -***************************************************************************** -**/ +/** +* @brief Function called to initialize the plugin +* +* @param meth ? +* @param cbl ? +* @param attrs ? +* +* @return Pointer on the private data of the plugin +* +* @remarks Private data is allocated by this function (g_new0) +*/ static struct vehicle_priv * vehicle_file_new_file(struct vehicle_methods *meth, struct callback_list @@ -958,7 +990,7 @@ vehicle_file_new_file(struct vehicle_methods if(source == NULL){ dbg(lvl_error,"Missing source attribute"); return NULL; - } + } ret = g_new0(struct vehicle_priv, 1); // allocate and initialize to 0 ret->fd = -1; ret->cbl = cbl; @@ -966,6 +998,8 @@ vehicle_file_new_file(struct vehicle_methods ret->buffer = g_malloc(buffer_size); ret->time=1000; ret->baudrate=B4800; + ret->fixtime[0] = '\0'; + ret->ev_fix_timeout = NULL; state_file=attr_search(attrs, NULL, attr_state_file); if (state_file) ret->statefile=g_strdup(state_file->u.str); @@ -1014,6 +1048,7 @@ vehicle_file_new_file(struct vehicle_methods *meth = vehicle_file_methods; ret->cb=callback_new_1(callback_cast(vehicle_file_io), ret); ret->cbt=callback_new_1(callback_cast(vehicle_file_enable_watch_timer), ret); + ret->cb_fix_timeout=callback_new_1(callback_cast(vehicle_file_fix_timeout_cb), ret); if (ret->statefile && file_exists(ret->statefile)) { ret->process_statefile=1; event_add_timeout(1000, 0, ret->cb); @@ -1038,12 +1073,9 @@ vehicle_file_new_file(struct vehicle_methods return ret; } -//*************************************************************************** -/** @fn void plugin_init(void) -***************************************************************************** -* @b Description: Initialisation of vehicle_file plugin -***************************************************************************** -**/ +/** +* @brief Initialisation of vehicle_file plugin +*/ void plugin_init(void) { dbg(lvl_debug, "vehicle_file:plugin_init:enter\n"); diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index 27025c0a6..975d9c68a 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -35,6 +35,14 @@ #include "event.h" #include "types.h" +/** + * @defgroup vehicle-gpsd Vehicle Gpsd + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from the gpsd service + * + * @{ + */ + static struct vehicle_priv { char *source; char *gpsd_query; diff --git a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c index fa5eb8780..ebdf08707 100644 --- a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c +++ b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -34,6 +34,14 @@ #include "vehicle.h" #include "event.h" +/** + * @defgroup vehicle-gpsd-dbus Vehicle Gpsd DBus + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from Gpsd over DBus + * + * @{ + */ + static char *vehicle_gpsd_dbus_prefix="gpsd_dbus:"; struct vehicle_priv { diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c index 589e53a3f..16175f2e8 100644 --- a/navit/vehicle/gypsy/vehicle_gypsy.c +++ b/navit/vehicle/gypsy/vehicle_gypsy.c @@ -1,6 +1,4 @@ -/** @file vehicle_gypsy.c - * @brief gypsy uses dbus signals - * +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -18,8 +16,6 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * - * @Author Tim Niemeyer <reddog@mastersword.de> - * @date 2008-2009 */ #include <config.h> @@ -47,6 +43,16 @@ #include "item.h" #include "vehicle.h" +/** + * @defgroup vehicle-gypsy Vehicle gypsy + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from gypsy. gypsy uses dbus signals + * @Author Tim Niemeyer <reddog@mastersword.de> + * @date 2008-2009 + * + * @{ + */ + static struct vehicle_priv { char *source; GypsyControl *control; diff --git a/navit/vehicle/iphone/vehicle_iphone.c b/navit/vehicle/iphone/vehicle_iphone.c index 94fec114a..f8ce5b644 100644 --- a/navit/vehicle/iphone/vehicle_iphone.c +++ b/navit/vehicle/iphone/vehicle_iphone.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -33,6 +33,14 @@ #include "event.h" #include "corelocation.h" +/** + * @defgroup vehicle-iphone Vehicle iPhone + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from iPhone. + * + * @{ + */ + struct vehicle_priv { int interval; int position_set; diff --git a/navit/vehicle/maemo/vehicle_maemo.c b/navit/vehicle/maemo/vehicle_maemo.c index d686a6a03..015f1c8e3 100644 --- a/navit/vehicle/maemo/vehicle_maemo.c +++ b/navit/vehicle/maemo/vehicle_maemo.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -18,14 +18,6 @@ */ -/* - Plugin for new Maemo's liblocation API. - - <vehicle source="maemo://any" retry_interval="1"/> - source cound be on of "any","cwp","acwp","gnss","agnss" - retry_interval could be one of "1","2","5","10","20","30","60","120" measured in seconds -*/ - #include <config.h> #include <string.h> #include <glib.h> @@ -40,6 +32,19 @@ #include "vehicle.h" #include "event.h" +/** + * @defgroup vehicle-iphone Vehicle Maemo + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from Maemo. + * + * Plugin for new Maemo's liblocation API. + * <vehicle source="maemo://any" retry_interval="1"/> + * source cound be on of "any","cwp","acwp","gnss","agnss" + * retry_interval could be one of "1","2","5","10","20","30","60","120" measured in seconds + * + * @{ + */ + static struct vehicle_priv { LocationGPSDControl *control; LocationGPSDevice *device; diff --git a/navit/vehicle/null/vehicle_null.c b/navit/vehicle/null/vehicle_null.c index 643945c71..6b723f9ff 100644 --- a/navit/vehicle/null/vehicle_null.c +++ b/navit/vehicle/null/vehicle_null.c @@ -1,4 +1,4 @@ -/** @file vehicle_null.c +/* * @brief null uses dbus signals * * Navit, a modular navigation system. @@ -34,6 +34,14 @@ #include "item.h" #include "vehicle.h" +/** + * @defgroup vehicle-null Vehicle Null + * @ingroup vehicle-plugins + * @brief A dummy Vehicle to have a null movement. + * + * @{ + */ + struct vehicle_priv { struct callback_list *cbl; struct coord_geo geo; diff --git a/navit/vehicle/qt5/vehicle_qt5.cpp b/navit/vehicle/qt5/vehicle_qt5.cpp index 2a2b6f5cf..fc8a6635a 100644 --- a/navit/vehicle/qt5/vehicle_qt5.cpp +++ b/navit/vehicle/qt5/vehicle_qt5.cpp @@ -1,5 +1,4 @@ -/** @file vehicle_null.c - * @brief null uses dbus signals +/* * * Navit, a modular navigation system. * Copyright (C) 2005-2017 Navit Team @@ -41,6 +40,15 @@ extern "C" { #include "vehicle_qt5.h" #include "vehicle_qt5.moc" #include <QDateTime> + +/** + * @defgroup vehicle-qt5 Vehicle QT5 + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from qt5 + * + * @{ + */ + QNavitGeoReceiver::QNavitGeoReceiver(QObject* parent, struct vehicle_priv* c) : QObject(parent) { diff --git a/navit/vehicle/webos/vehicle_webos.c b/navit/vehicle/webos/vehicle_webos.c index a5bba4bce..c4bdcbaf2 100644 --- a/navit/vehicle/webos/vehicle_webos.c +++ b/navit/vehicle/webos/vehicle_webos.c @@ -1,4 +1,4 @@ -/** +/* * vim: sw=3 ts=3 * * Navit, a modular navigation system. @@ -37,6 +37,14 @@ #include "vehicle_webos.h" #include "bluetooth.h" +/** + * @defgroup vehicle-webos Vehicle WebOS + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from WebOS + * + * @{ + */ + static char *vehicle_webos_prefix="webos:"; /*******************************************************************/ diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c index d43c516f7..49f90b1f5 100644 --- a/navit/vehicle/wince/vehicle_wince.c +++ b/navit/vehicle/wince/vehicle_wince.c @@ -1,4 +1,4 @@ -/** +/* * Navit, a modular navigation system. * Copyright (C) 2005-2008 Navit Team * @@ -44,6 +44,14 @@ #include <wchar.h> #include "support/win32/ConvertUTF.h" +/** + * @defgroup vehicle-wince Vehicle WinCE + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from WinCE + * + * @{ + */ + #define SwitchToThread() Sleep(0) typedef int (WINAPI *PFN_BthSetMode)(DWORD pBthMode); @@ -83,6 +91,8 @@ struct vehicle_priv { char *source; struct callback_list *cbl; struct callback_list *priv_cbl; + struct callback *cb_fix_timeout; + struct event_timeout *ev_fix_timeout; int is_running; int thread_up; int fd; @@ -365,6 +375,36 @@ vehicle_wince_available_ports(void) } +/** +* @brief This is a callback function, called when the fix timeout +* is done. Set the position to invalid. +* +* @param priv Pointer on the private data of the plugin +*/ +static void +vehicle_wince_fix_timeout_cb(struct vehicle_priv *priv) +{ + priv->valid = attr_position_valid_invalid; + priv->ev_fix_timeout = NULL; + callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); +} + + +/** +* @brief Cancel previous fix timeout event and add a new one +* +* @param priv Pointer on the private data of the plugin +*/ +static void +vehicle_wince_restart_fix_timeout(struct vehicle_priv *priv) +{ + if (priv->ev_fix_timeout != NULL) + event_remove_timeout(priv->ev_fix_timeout); + priv->ev_fix_timeout = event_add_timeout(10000, 0, priv->cb_fix_timeout); +} + + + static int vehicle_wince_open(struct vehicle_priv *priv) { @@ -474,7 +514,7 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer) UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7], HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14] */ - if (*item[2] && *item[3] && *item[4] && *item[5]) { + if (*item[2] && *item[3] && *item[4] && *item[5] && *item[6] > 0) { lat = g_ascii_strtod(item[2], NULL); priv->geo.lat = floor(lat / 100); lat -= priv->geo.lat * 100; @@ -490,20 +530,31 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer) if (!g_strcasecmp(item[5],"W")) priv->geo.lng=-priv->geo.lng; - priv->valid=attr_position_valid_valid; + + if (priv->valid == attr_position_valid_invalid) + ret = 1; + priv->valid = attr_position_valid_valid; + vehicle_wince_restart_fix_timeout(priv); + + if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) { + ret = 1; + strncpy(priv->fixtime, item[1], sizeof(priv->fixtime)); + } dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng); - } else + } else { + if (priv->valid == attr_position_valid_valid) + ret = 1; priv->valid=attr_position_valid_invalid; + } + if (*item[6]) sscanf(item[6], "%d", &priv->status); if (*item[7]) - sscanf(item[7], "%d", &priv->sats_used); + sscanf(item[7], "%d", &priv->sats_used); if (*item[8]) sscanf(item[8], "%lf", &priv->hdop); - if (*item[1]) - strncpy(priv->fixtime, item[1], sizeof(priv->fixtime)); if (*item[9]) sscanf(item[9], "%lf", &priv->height); @@ -547,8 +598,40 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer) &priv->fixmonth, &priv->fixyear); priv->fixyear += 2000; + + lat = g_ascii_strtod(item[3], NULL); + priv->geo.lat = floor(lat / 100); + lat -= priv->geo.lat * 100; + priv->geo.lat += lat / 60; + + if (!g_ascii_strcasecmp(item[4],"S")) + priv->geo.lat=-priv->geo.lat; + + lng = g_ascii_strtod(item[5], NULL); + priv->geo.lng = floor(lng / 100); + lng -= priv->geo.lng * 100; + priv->geo.lng += lng / 60; + + if (!g_ascii_strcasecmp(item[6],"W")) + priv->geo.lng=-priv->geo.lng; + + if (priv->valid == attr_position_valid_invalid) + ret = 1; + priv->valid=attr_position_valid_valid; + vehicle_wince_restart_fix_timeout(priv); + + if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) { + ret = 1; + strncpy(priv->fixtime, item[1], sizeof(priv->fixtime)); + } + + dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng); + + } else { + if (priv->valid == attr_position_valid_valid) + ret = 1; + priv->valid=attr_position_valid_invalid; } - ret = 1; } if (!strncmp(buffer, "$GPGSV", 6) && i >= 4) { /* @@ -741,7 +824,8 @@ vehicle_wince_destroy(struct vehicle_priv *priv) * @param priv vehicle_priv structure for the vehicle * @param type The attribute type to retrieve * @param attr Points to an attr structure that will receive the attribute data - * @returns True for success, false for failure + * + * @return True for success, false for failure */ static int vehicle_wince_position_attr_get(struct vehicle_priv *priv, @@ -863,10 +947,11 @@ struct vehicle_methods vehicle_wince_methods = { /** * @brief Creates a new wince_vehicle * - * @param meth - * @param cbl - * @param attrs - * @returns vehicle_priv + * @param meth ? + * @param cbl ? + * @param attrs ? + * + * @return vehicle_priv */ static struct vehicle_priv * vehicle_wince_new(struct vehicle_methods @@ -902,6 +987,8 @@ vehicle_wince_new(struct vehicle_methods ret->buffer = g_malloc(buffer_size); ret->time=1000; ret->baudrate=0; // do not change the rate if not configured + ret->fixtime[0] = '\0'; + ret->ev_fix_timeout = NULL; time = attr_search(attrs, NULL, attr_time); if (time) @@ -923,6 +1010,7 @@ vehicle_wince_new(struct vehicle_methods *meth = vehicle_wince_methods; ret->priv_cbl = callback_list_new(); callback_list_add(ret->priv_cbl, callback_new_1(callback_cast(vehicle_wince_io), ret)); + ret->cb_fix_timeout=callback_new_1(callback_cast(vehicle_wince_fix_timeout_cb), ret); ret->sat_item.type=type_position_sat; ret->sat_item.id_hi=ret->sat_item.id_lo=0; ret->sat_item.priv_data=ret; diff --git a/navit/xmlconfig.h b/navit/xmlconfig.h index 2a2600473..483f215d0 100644 --- a/navit/xmlconfig.h +++ b/navit/xmlconfig.h @@ -65,20 +65,51 @@ typedef void *(*object_func_ref)(void *); typedef void *(*object_func_unref)(void *); +/** + * @brief Basic functions for Navit objects + * + * This is the minimal list of functions which is supported by every Navit object. + * + * Some members can be NULL for certain object types: while Navit does not mandate this function to be + * implemented for every object class, the function may need to be defined for some object classes. + * + * Default implementations are available for every function in the list except `create`, `init` and + * `dup`. These can be set directly, or type-specific implementations can call through to them as they + * see fit. + */ struct object_func { - enum attr_type type; - void *(*create)(struct attr *parent, struct attr **attrs); - int (*get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter); - struct attr_iter *(*iter_new)(void *); - void (*iter_destroy)(struct attr_iter *); - int (*set_attr)(void *, struct attr *attr); - int (*add_attr)(void *, struct attr *attr); - int (*remove_attr)(void *, struct attr *attr); - int (*init)(void *); - void (*destroy)(void *); - void *(*dup)(void *); - void *(*ref)(void *); - void *(*unref)(void *); + enum attr_type type; /**< The object type */ + void *(*create)(struct attr *parent, struct attr **attrs); /**< Function to create a new object instance */ + int (*get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter); /**< Function + * to get an attribute of the object, + * set to `navit_object_get_attr` for default behavior */ + struct attr_iter *(*iter_new)(void *); /**< Function to obtain a new attribute iterator, + * set to `navit_object_attr_iter_new` for default + * behavior, can be NULL for some object types */ + void (*iter_destroy)(struct attr_iter *); /**< Function to destroy an attribute iterator, + * set to `navit_object_attr_iter_destroy` for default + * behavior, can be NULL for some object types */ + int (*set_attr)(void *, struct attr *attr); /**< Function to set an attribute, + * set to `navit_object_set_attr` for default behavior, + * can be NULL for some object types */ + int (*add_attr)(void *, struct attr *attr); /**< Function to add an attribute, + * set to `navit_object_add_attr` for default behavior, + * can be NULL for some object types */ + int (*remove_attr)(void *, struct attr *attr); /**< Function to remove an attribute, + * set to `navit_object_remove_attr` for default behavior, + * can be NULL for some object types */ + int (*init)(void *); /**< TODO, + * can be NULL for some object types */ + void (*destroy)(void *); /**< Function to destroy an object instance, + * set to `navit_object_destroy` for default behavior, + * can be NULL */ + void *(*dup)(void *); /**< Function to create a copy of an object instance */ + void *(*ref)(void *); /**< Function to increase the reference count for an + * object instance, set to `navit_object_ref` for + * default behavior, can be NULL for some object types */ + void *(*unref)(void *); /**< Function to decrease the reference count for an + * object instance, set to `navit_object_unref` for + * default behavior, can be NULL for some object types */ }; extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func, speech_func, navigation_func, route_func; |