From d68c24642e25fdc34bb001c1ddd5d2d680670883 Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Tue, 20 Jun 2017 15:59:11 +0200 Subject: Fix minor bugs, add DLT to poi-server --- src/navigation/build.sh | 77 +++++++++++++++------- .../genivi_navigationcore_guidance.cxx | 34 +++++++++- src/poi-service/CMakeLists.txt | 15 +++++ src/poi-service/build.sh | 66 ++++++++++++------- src/poi-service/poi-server/CMakeLists.txt | 1 + src/poi-service/poi-server/main.cpp | 15 ++++- 6 files changed, 158 insertions(+), 50 deletions(-) diff --git a/src/navigation/build.sh b/src/navigation/build.sh index 806c2b0..5277477 100755 --- a/src/navigation/build.sh +++ b/src/navigation/build.sh @@ -1,11 +1,39 @@ #!/bin/bash -clean=0 -capi=0 -navit=0 -poi=0 -dlt_option="-DWITH_DLT=OFF" -commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=OFF" +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# \copyright Copyright (C) 2013-2017, PSA Group +# +# \file build.sh +# +# \brief This file is part of the Build System for navigation. +# +# \author Philippe Colliot +# +# \version 1.0 +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License (MPL), v. 2.0. +# If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# For further information see http://www.genivi.org/. +# +# List of changes: +# +# +# @licence end@ +########################################################################### + +clean=0 #no clean (means no cmake) -> -c option +capi=0 #no common api -> -m option +commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=OFF" +navit=0 #no build of navit -> -n option +poi=0 #no build of poi -> -p option +dlt_option="OFF" #no DLT -> -l option +debug="OFF" #no debug -> -d option function check_path_for_capi { @@ -33,17 +61,22 @@ function check_path_for_capi commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=ON -DWITH_DBUS_INTERFACE=OFF -DDBUS_LIB_PATH="$DBUS_LIB_PATH" -DCOMMONAPI_DBUS_TOOL_DIR="$COMMONAPI_DBUS_TOOL_DIR" -DCOMMONAPI_TOOL_DIR="$COMMONAPI_TOOL_DIR } -while getopts cdmnp opt +while getopts cdlmhnp opt do case $opt in c) clean=1 ;; d) - dlt_option="-DWITH_DLT=ON" + debug="ON" + ;; + l) + dlt_option="ON" ;; m) - capi=1 + capi=1 + #check commonapi settings + check_path_for_capi ;; n) navit=1 @@ -51,24 +84,20 @@ do p) poi=1 ;; - \?) + h) echo "Usage:" - echo "$0 [-cdmnp]" - echo "-c: clean and build" - echo "-d: build with dlt (only with -c)" - echo "-m: build with commonAPI plugins (only with -c) " - echo "-n: build navit" - echo "-p: build poi" + echo "$0 [-cdhlmnp]" + echo "-c: Rebuild with clean" + echo "-d: Enable the debug messages" + echo "-h: Help" + echo "-l: Build with dlt (only with -c)" + echo "-m: Build with commonAPI plugins (only with -c)" + echo "-n: Build navit" + echo "-p: Build poi" exit 1 esac done -#check commonapi settings -if [ "$capi" = 1 ] -then - check_path_for_capi -fi - #clean if [ "$clean" = 1 ] && [ -d "./build" ] then @@ -114,7 +143,7 @@ cd .. echo 'build navigation' if [ "$clean" = 1 ] then - cmake $dlt_option $commonapi_tools_option ../ + cmake -DWITH_DLT=$dlt_option $commonapi_tools_option -DWITH_DEBUG=$debug ../ echo 'replace a missing font in the configuration file of navit instances' sed -i -e 's/Liberation Sans/TakaoPGothic/' ./navit/navit/navit_genivi_mapviewer.xml sed -i -e 's/Liberation Sans/TakaoPGothic/' ./navit/navit/navit_genivi_navigationcore.xml @@ -131,7 +160,7 @@ then echo 'build poi' if [ "$clean" = 1 ] then - cmake -DWITH_PLUGIN_MIGRATION=0 ../ + cmake -DWITH_DLT=$dlt_option -DWITH_DEBUG=$debug -DWITH_PLUGIN_MIGRATION=0 ../ fi make fi diff --git a/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx b/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx index 664383b..b4e60a0 100644 --- a/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx +++ b/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx @@ -605,7 +605,39 @@ GuidanceObj::GetManeuver(struct item *item, uint32_t& DistanceToManeuver, int32_ Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_STRAIGHT); break; - default: + case type_nav_merge_left: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_LEFT); + break; + case type_nav_merge_right: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_RIGHT); + break; + case type_nav_turnaround_left: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_UTURN_LEFT); + break; + case type_nav_turnaround_right: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_UTURN_RIGHT); + break; + case type_nav_exit_left: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_LEFT); + break; + case type_nav_exit_right: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_RIGHT); + break; + case type_nav_keep_left: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_LEFT); + break; + case type_nav_keep_right: + Maneuver=GENIVI_NAVIGATIONCORE_DESTINATION; + data._2=variant_enumeration(GENIVI_NAVIGATIONCORE_RIGHT); + break; + default: dbg(lvl_error,"Unable to convert type %s\n",item_to_name(item->type)); Maneuver=GENIVI_NAVIGATIONCORE_INVALID; index = GENIVI_NAVIGATIONCORE_INVALID; diff --git a/src/poi-service/CMakeLists.txt b/src/poi-service/CMakeLists.txt index dc8bc8e..ec38c83 100644 --- a/src/poi-service/CMakeLists.txt +++ b/src/poi-service/CMakeLists.txt @@ -17,6 +17,7 @@ ########################################################################### project(poi-service-server) cmake_minimum_required(VERSION 2.8) +find_package(PkgConfig) message(STATUS ${PROJECT_NAME}) @@ -24,11 +25,14 @@ option(WITH_DBUS_INTERFACE "Build using the D-Bus interfaces" ON) option(WITH_DEBUG "Enable the debug messages" OFF) +option(WITH_DLT + "Enable DLT logging" OFF) option(WITH_PLUGIN_MIGRATION "Enable navit plugin migration to commonapi" OFF) message(STATUS "WITH_DBUS_INTERFACE = ${WITH_DBUS_INTERFACE}") message(STATUS "WITH_DEBUG = ${WITH_DEBUG}") +message(STATUS "WITH_DLT = ${WITH_DLT}") message(STATUS "WITH_PLUGIN_MIGRATION = ${WITH_PLUGIN_MIGRATION}") set(API_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api") @@ -38,6 +42,17 @@ set(COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/poi-common") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) +if(${WITH_DLT}) + add_definitions("-DDLT_ENABLED=1") + pkg_check_modules(DLT REQUIRED automotive-dlt) + include_directories( ${DLT_INCLUDE_DIRS} ) + set(LIBRARIES ${LIBRARIES} ${DLT_LIBRARIES}) +endif() + +if(WITH_DEBUG) + add_definitions("-DDEBUG_ENABLED=1") +endif() + if (WITH_PLUGIN_MIGRATION) add_subdirectory(poi-server-capi) else() diff --git a/src/poi-service/build.sh b/src/poi-service/build.sh index 675923b..ba31142 100755 --- a/src/poi-service/build.sh +++ b/src/poi-service/build.sh @@ -1,9 +1,37 @@ #!/bin/bash -debug="OFF" -clean=0 -capi=0 -commonapi_tools_option="" +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# \copyright Copyright (C) 2013-2017, PSA Group +# +# \file build.sh +# +# \brief This file is part of the Build System for poi. +# +# \author Philippe Colliot +# +# \version 1.0 +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License (MPL), v. 2.0. +# If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. +# +# For further information see http://www.genivi.org/. +# +# List of changes: +# +# +# @licence end@ +########################################################################### + +clean=0 #no clean (means no cmake) -> -c option +capi=0 #no common api -> -m option +commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=OFF" +dlt_option="OFF" #no DLT -> -l option +debug="OFF" #no debug -> -d option function check_path_for_capi { @@ -31,7 +59,7 @@ function check_path_for_capi commonapi_tools_option="-DDBUS_LIB_PATH="$DBUS_LIB_PATH" -DCOMMONAPI_DBUS_TOOL_DIR="$COMMONAPI_DBUS_TOOL_DIR" -DCOMMONAPI_TOOL_DIR="$COMMONAPI_TOOL_DIR } -while getopts cdmh opt +while getopts cdhlmh opt do case $opt in c) @@ -40,24 +68,26 @@ do d) debug="ON" ;; + l) + dlt_option="ON" + ;; m) capi=1 + #check commonapi settings + check_path_for_capi ;; h) echo "Usage:" - echo "$0 [-cdm]" - echo "-c: build with clean" + echo "$0 [-cdhlm]" + echo "-c: Rebuild with clean" echo "-d: Enable the debug messages" - echo "-m: build with commonAPI plugins " + echo "-h: Help" + echo "-l: Build with dlt (only with -c)" + echo "-m: Build with commonAPI plugins (only with -c)" exit 1 esac done -if [ "$capi" = 1 ] -then - check_path_for_capi -fi - set -e if [ "$clean" = 1 ] @@ -75,15 +105,7 @@ cd build echo 'build poi-server' if [ "$clean" = 1 ] then - if [ "$capi" = 0 ] - then - cmake -DWITH_PLUGIN_MIGRATION=0 -DWITH_DEBUG=$debug ../ - else - cmake -DWITH_PLUGIN_MIGRATION=ON -DWITH_DBUS_INTERFACE=OFF $commonapi_tools_option -DWITH_DEBUG=$debug ../ - echo 'fix a bug in the generation of CommonAPI hpp' - sed -i -e 's/(const TimeStampedEnum::/(const ::v4::org::genivi::navigation::navigationcore::NavigationCoreTypes::TimeStampedEnum::/' ./poi-server-capi/src-gen/v4/org/genivi/navigation/navigationcore/LocationInput.hpp - sed -i -e 's/(const TimeStampedEnum::/(const ::v4::org::genivi::navigation::navigationcore::NavigationCoreTypes::TimeStampedEnum::/' ./poi-server-capi/src-gen/v4/org/genivi/navigation/navigationcore/MapMatchedPosition.hpp - fi + cmake -DWITH_DLT=$dlt_option $commonapi_tools_option -DWITH_DEBUG=$debug ../ fi make diff --git a/src/poi-service/poi-server/CMakeLists.txt b/src/poi-service/poi-server/CMakeLists.txt index 0243461..7fdf1f3 100644 --- a/src/poi-service/poi-server/CMakeLists.txt +++ b/src/poi-service/poi-server/CMakeLists.txt @@ -61,6 +61,7 @@ add_executable(poi-server ) set(LIBRARIES + ${LIBRARIES} ${DBUS_CPP_LIBRARIES} ${GLIB_LIBRARIES} ${SQLITE3_LIBRARIES} diff --git a/src/poi-service/poi-server/main.cpp b/src/poi-service/poi-server/main.cpp index b903359..0af5db8 100644 --- a/src/poi-service/poi-server/main.cpp +++ b/src/poi-service/poi-server/main.cpp @@ -38,6 +38,10 @@ #include #include +#include "log.h" + +DLT_DECLARE_CONTEXT(gCtx); + #include "poi-common-database.h" #include "poi-server-class.h" @@ -116,6 +120,7 @@ void Routing::AlternativeRoutesAvailable (const std::vector& routeHa contentAccessModule::contentAccessModule(DBus::Connection &connection, const std::string& service) : DBus::ObjectProxy(connection, contentAccessModule_OBJECT_PATH,service.c_str()) { + LOG_INFO_MSG(gCtx,"poi content access module client\n"); } contentAccessModule::~contentAccessModule() @@ -152,6 +157,8 @@ void contentAccessModule::SearchStatusChanged(const uint32_t& poiSearchHandle, c poiContentAccessServer::poiContentAccessServer(DBus::Connection &connection) : DBus::ObjectAdaptor(connection, poiContentAccess_OBJECT_PATH) { + LOG_INFO_MSG(gCtx,"poi content access server\n"); + //version is hard coded m_version._1 = 0; m_version._2 = 4; @@ -685,6 +692,8 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa categoryId_t value; categoryId_t parent,child; + LOG_INFO_MSG(gCtx,"poi server\n"); + //version is hard coded DBus_version::version_t version; version.major = 1; @@ -2168,6 +2177,9 @@ void print_usage (FILE* stream, int exit_code) */ int main(int argc , char** argv ) { + DLT_REGISTER_APP("MPVS","MAP VIEWER CONTROL SERVER"); + DLT_REGISTER_CONTEXT(gCtx,"MPVS","Global Context"); + GMainLoop * mainloop ; // Set the global C and C++ locale to the user-configured locale, @@ -2238,9 +2250,6 @@ int main(int argc , char** argv ) // Create a new GMainLoop with default context and initial state of "not running " mainloop = g_main_loop_new (g_main_context_default() , FALSE ); - // Send a feedback to the user - cout << "poi server started" << endl; - // loop listening g_main_loop_run ( mainloop ); -- cgit v1.2.1