From 43e287f116712ffe61b3be5232622b6867a10588 Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Fri, 12 Aug 2016 17:26:14 +0200 Subject: CommonAPI: enhanced position plugin OK --- src/navigation/CMakeLists.txt | 42 ++--- src/navigation/README.md | 40 +++- src/navigation/build.sh | 8 +- src/navigation/commonapi-dbus.ini | 12 ++ .../configuration-server-plugin/CMakeLists.txt | 1 - .../mapviewercontrol-server-plugin/CMakeLists.txt | 1 - .../session-server-plugin/CMakeLists.txt | 1 - .../configuration-server-plugin/CMakeLists.txt | 1 - .../enhancedposition-client-plugin/CMakeLists.txt | 1 - .../genivi_positioning_enhancedposition.cxx | 14 +- .../guidance-server-plugin/CMakeLists.txt | 1 - .../genivi_navigationcore_guidance.cxx | 29 +-- .../locationinput-server-plugin/CMakeLists.txt | 1 - .../CMakeLists.txt | 1 - .../poicam-server-plugin/CMakeLists.txt | 1 - .../routing-server-plugin/CMakeLists.txt | 1 - .../session-server-plugin/CMakeLists.txt | 1 - src/navigation/run-capi | 203 +++++++++++++++++++++ 18 files changed, 306 insertions(+), 53 deletions(-) create mode 100755 src/navigation/run-capi (limited to 'src') diff --git a/src/navigation/CMakeLists.txt b/src/navigation/CMakeLists.txt index bb599cc..da2a773 100644 --- a/src/navigation/CMakeLists.txt +++ b/src/navigation/CMakeLists.txt @@ -19,8 +19,6 @@ project(navigation) cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") -option(WITH_FRANCA_DBUS_INTERFACE - "Build using the Franca interfaces" OFF) option(WITH_DBUS_INTERFACE "Build using the D-Bus interfaces" ON) option(WITH_DEBUG @@ -40,7 +38,6 @@ option(NAVIT_NULL_VEHICLE option(NAVIT_QTPAINTER "qtqpainter for navit" 0) -message(STATUS "WITH_FRANCA_DBUS_INTERFACE = ${WITH_FRANCA_DBUS_INTERFACE}") message(STATUS "WITH_DBUS_INTERFACE = ${WITH_DBUS_INTERFACE}") message(STATUS "WITH_DEBUG = ${WITH_DEBUG}") message(STATUS "WITH_SPEECH = ${WITH_SPEECH}") @@ -84,12 +81,26 @@ set(DBUS_GENERATED_INCLUDE_DIR_POSITIONING_PARENT_SCOPE ${DBUS_GENERATED_INCLUDE endif(hasParent) if(NOT ${YOCTO_CONFIG}) + # for enhanced position service if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/positioning") message(FATAL_ERROR "Don't you forget to download additional code ? Please see README first") endif() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) - add_subdirectory(positioning) + if (WITH_PLUGIN_MIGRATION) + set(FRANCA_POSITIONING_DIR "${CMAKE_CURRENT_SOURCE_DIR}/positioning/enhanced-position-service/franca/api") + execute_process(COMMAND uname -i OUTPUT_VARIABLE OS_VERSION) + if("${OS_VERSION}" MATCHES "i686") + set(OS_VERSION "x86") + else() + set(OS_VERSION "x86_64") + endif() + set(WITH_FRANCA_DBUS_INTERFACE "ON" CACHE INTERNAL "") + set(COMMONAPI_TOOL_GENERATOR "${COMMONAPI_TOOL_DIR}/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/${OS_VERSION}/commonapi-generator-linux-${OS_VERSION}" CACHE INTERNAL "") + set(COMMONAPI_DBUS_TOOL_GENERATOR "${COMMONAPI_DBUS_TOOL_DIR}/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/${OS_VERSION}/commonapi-dbus-generator-linux-${OS_VERSION}" CACHE INTERNAL "") + set(COMMONAPI_GEN_DIR_POSITIONING "${CMAKE_CURRENT_BINARY_DIR}/enhanced-position-service/franca/api") + endif() + add_subdirectory(positioning) unset(CMAKE_LIBRARY_OUTPUT_DIRECTORY) unset(CMAKE_RUNTIME_OUTPUT_DIRECTORY) endif() @@ -107,11 +118,6 @@ endif() add_subdirectory(map) -add_subdirectory(${API_DIR}/navigation-core "${DBUS_GENERATED_INCLUDE_DIR}/navigation-core") - -add_subdirectory(${API_DIR}/map-viewer "${DBUS_GENERATED_INCLUDE_DIR}/map-viewer") - -add_subdirectory(${API_DIR}/poi-service "${DBUS_GENERATED_INCLUDE_DIR}/poi-service") if(${WITH_SPEECH}) add_subdirectory(${API_DIR}/speech-service "${DBUS_GENERATED_INCLUDE_DIR}/speech-service") @@ -125,19 +131,11 @@ if (WITH_PLUGIN_MIGRATION) # for hmi and navigation set(FRANCA_DIR "${API_DIR}/franca") add_subdirectory(${FRANCA_DIR} "${CMAKE_CURRENT_BINARY_DIR}/franca") - # for enhanced position service - set(FRANCA_POSITIONING_DIR "${CMAKE_CURRENT_SOURCE_DIR}/positioning/enhanced-position-service/franca/api") - execute_process(COMMAND uname -i OUTPUT_VARIABLE OS_VERSION) - if("${OS_VERSION}" MATCHES "i686") - set(OS_VERSION "x86") - else() - set(OS_VERSION "x86_64") - endif() - set(COMMONAPI_TOOL_GENERATOR "${COMMONAPI_TOOL_DIR}/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/${OS_VERSION}/commonapi-generator-linux-${OS_VERSION}") - set(COMMONAPI_DBUS_TOOL_GENERATOR "${COMMONAPI_DBUS_TOOL_DIR}/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/${OS_VERSION}/commonapi-dbus-generator-linux-${OS_VERSION}") - set(WITH_FRANCA_DBUS_INTERFACE "ON") - set(COMMONAPI_GEN_DIR_POSITIONING "${CMAKE_CURRENT_BINARY_DIR}/enhanced-position-service/franca/api") - add_subdirectory(${FRANCA_POSITIONING_DIR} "${CMAKE_CURRENT_BINARY_DIR}/franca-positioning") +else() + #generates the GLib DBus proxies and adaptors + add_subdirectory(${API_DIR}/navigation-core "${DBUS_GENERATED_INCLUDE_DIR}/navigation-core") + add_subdirectory(${API_DIR}/map-viewer "${DBUS_GENERATED_INCLUDE_DIR}/map-viewer") + add_subdirectory(${API_DIR}/poi-service "${DBUS_GENERATED_INCLUDE_DIR}/poi-service") endif() add_subdirectory(navigation-core) diff --git a/src/navigation/README.md b/src/navigation/README.md index 7794076..b3389ae 100644 --- a/src/navigation/README.md +++ b/src/navigation/README.md @@ -34,7 +34,7 @@ or to build updated parts ## How to test Some python scripts can be used for test. -Goto ../../test/navigation +Go to ../../test/navigation For Python, you need to install some modules sudo apt-get install python-pip python-dbus python-gobject python-pil sudo pip install --upgrade pip @@ -68,6 +68,44 @@ basic code of navit positioning/ the code of positioning +## How to for the CommonAPI based version (draft) +The former version of the POCs is based on GLib DBus. A migration to CommonAPI is under progress. + +###Prerequisites +You need CommonAPI 3.1.5 and Franca 0.9.1 installed +For the Ubuntu 64 bits, due to the use of symbol versioning LIBDBUS_1_0 by CommonAPI-DBus, the patched version of DBus has to be >= 1.10.0 +NB: the patch common-api-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch failed a little bit, it's needed to update the dbus/dbus-string.h manually + +### How to build +First it's required to set some paths: +``` +export DBUS_LIB_PATH= +export COMMONAPI_DBUS_TOOL_DIR= +export COMMONAPI_TOOL_DIR= +``` +A script allows either: +to clean and rebuild all (including invoking cmake) +./build.sh -cm +or to build updated parts +./build.sh -m + +### How to test +Some python scripts can be used for test. +Go to ../../test/navigation +For Python, you need to install some modules (see explanations above) + +To test, launch the navigation middleware by entering: +./run-capi -r +test files: +./test-route-calculation-capi.py +./test-location-input-capi.py +./test-map-viewer-control-capi.py +NB: there's a bug when the map is closed, so you need to restart the navigation after the last one + +If everything is OK, you must see: + +Test PASSED + ##Known issues There's an issue with navit against gtk. diff --git a/src/navigation/build.sh b/src/navigation/build.sh index c36b681..af333f4 100755 --- a/src/navigation/build.sh +++ b/src/navigation/build.sh @@ -2,9 +2,11 @@ clean=0 capi=0 +commonapi_tools_option="" function check_path_for_capi { + echo 'check path for CommonAPI' if [ ! $COMMONAPI_TOOL_DIR ] then echo 'Set the dir of the common api tools' @@ -25,6 +27,7 @@ function check_path_for_capi echo 'export DBUS_LIB_PATH=' exit 1 fi + 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 cm opt @@ -77,7 +80,10 @@ then then cmake -DWITH_PLUGIN_MIGRATION=0 ../ else - cmake -DWITH_PLUGIN_MIGRATION=1 -DDBUS_LIB_PATH=$DBUS_LIB_PATH -DCOMMONAPI_TOOL_DIR=$COMMONAPI_TOOL_DIR -DCOMMONAPI_DBUS_TOOL_DIR=$COMMONAPI_DBUS_TOOL_DIR ../ + cmake -DWITH_PLUGIN_MIGRATION=ON -DWITH_DBUS_INTERFACE=OFF $commonapi_tools_option ../ + echo 'fix a bug in the generation of CommonAPI hpp' + sed -i -e 's/(const TimeStampedEnum::/(const ::v4::org::genivi::navigation::navigationcore::NavigationCoreTypes::TimeStampedEnum::/' ./franca/src-gen/v4/org/genivi/navigation/navigationcore/LocationInput.hpp + sed -i -e 's/(const TimeStampedEnum::/(const ::v4::org::genivi::navigation::navigationcore::NavigationCoreTypes::TimeStampedEnum::/' ./franca/src-gen/v4/org/genivi/navigation/navigationcore/MapMatchedPosition.hpp fi fi make diff --git a/src/navigation/commonapi-dbus.ini b/src/navigation/commonapi-dbus.ini index 2541d48..b6ec224 100644 --- a/src/navigation/commonapi-dbus.ini +++ b/src/navigation/commonapi-dbus.ini @@ -42,4 +42,16 @@ interface=org.genivi.navigation.mapviewer.MapViewerControl service=org.genivi.navigation.mapviewer path=/org/genivi/navigation/mapviewer/Session interface=org.genivi.navigation.mapviewer.Session +[local:org.genivi.EnhancedPositionService.PositionFeedback:EnhancedPositionService] +service=org.genivi.EnhancedPositionService +path=/org/genivi/EnhancedPositionService/PositionFeedback +interface=org.genivi.EnhancedPositionService.PositionFeedback +[local:org.genivi.EnhancedPositionService.EnhancedPosition:EnhancedPositionService] +service=org.genivi.EnhancedPositionService +path=/org/genivi/EnhancedPositionService/EnhancedPosition +interface=org.genivi.EnhancedPositionService.EnhancedPosition +[local:org.genivi.EnhancedPositionService.Configuration:EnhancedPositionService] +service=org.genivi.EnhancedPositionService +path=/org/genivi/EnhancedPositionService/Configuration +interface=org.genivi.EnhancedPositionService.Configuration diff --git a/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt b/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt index 37d7e24..f04c55f 100644 --- a/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt +++ b/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt b/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt index b8c39e2..115d8ae 100644 --- a/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt +++ b/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt b/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt index bde8c8a..797bf89 100644 --- a/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt +++ b/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt @@ -30,7 +30,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt index 26b3376..7b286e6 100644 --- a/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt b/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt index 83a9142..65bcaa7 100644 --- a/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/enhancedposition-client-plugin/genivi_positioning_enhancedposition.cxx b/src/navigation/navigation-core/enhancedposition-client-plugin/genivi_positioning_enhancedposition.cxx index 583432a..e1645a2 100644 --- a/src/navigation/navigation-core/enhancedposition-client-plugin/genivi_positioning_enhancedposition.cxx +++ b/src/navigation/navigation-core/enhancedposition-client-plugin/genivi_positioning_enhancedposition.cxx @@ -111,13 +111,16 @@ class EnhancedPositionClientProxy { dbg(lvl_debug,"enter\n"); bool position_found=false; + printf("A %ld\n",changedValues); if ((changedValues & (EnhancedPositionServiceTypes::PositionInfoKey::LATITUDE | EnhancedPositionServiceTypes::PositionInfoKey::LONGITUDE)) == (EnhancedPositionServiceTypes::PositionInfoKey::LATITUDE | EnhancedPositionServiceTypes::PositionInfoKey::LONGITUDE)) { position_found=true; } if (position_found && !mp_priv->cb_pending) { + printf("B %ld\n",changedValues); event_add_timeout(0, 0, mp_priv->cb); mp_priv->cb_pending=1; + printf("B %ld\n",changedValues); } } }; @@ -218,8 +221,9 @@ static void vehicle_process_map(struct vehicle_priv *priv, EnhancedPositionServiceTypes::PositionInfo& map) { EnhancedPositionServiceTypes::PositionInfo::const_iterator itr; - for(itr = map.begin(); itr != map.end(); ++itr) { - switch ((*itr).first) { + + for(itr = map.begin(); itr != map.end(); ++itr) { + switch ((*itr).first) { case EnhancedPositionServiceTypes::PositionInfoKey::LATITUDE: priv->geo.lat=(*itr).second.get(); break; @@ -230,7 +234,7 @@ vehicle_process_map(struct vehicle_priv *priv, EnhancedPositionServiceTypes::Pos // priv->height=(*itr).second.get(); break; case EnhancedPositionServiceTypes::PositionInfoKey::HEADING: -// priv->direction=(*itr).second.get(); +// priv->direction=(*itr).second.get(); break; case EnhancedPositionServiceTypes::PositionInfoKey::SPEED: priv->speed=floor((*itr).second.get()*360+0.5)/100; @@ -272,17 +276,17 @@ vehicle_enhancedposition_new(struct vehicle_methods *meth, ret = g_new0(struct vehicle_priv, 1); //init the enhanced position service client const std::string domain = "local"; - const std::string instanceEnhancedposition = "Enhancedposition"; + const std::string instanceEnhancedposition = "EnhancedPositionService"; ret->enhanced_position = new EnhancedPositionClientProxy(domain,instanceEnhancedposition); ret->enhanced_position->setListeners(); ret->enhanced_position->connectToVehicle(ret); - ret->cb=callback_new_1(callback_cast(vehicle_enhancedposition_callback), ret); ret->cbl=cbl; return ret; } + void plugin_init(void) { event_request_system("glib","genivi_navigationcore_enhpos"); diff --git a/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt index 026e166..8477e5b 100644 --- a/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/guidance-server-plugin/genivi_navigationcore_guidance.cxx b/src/navigation/navigation-core/guidance-server-plugin/genivi_navigationcore_guidance.cxx index 430ece7..b29c718 100644 --- a/src/navigation/navigation-core/guidance-server-plugin/genivi_navigationcore_guidance.cxx +++ b/src/navigation/navigation-core/guidance-server-plugin/genivi_navigationcore_guidance.cxx @@ -225,6 +225,7 @@ class GuidanceServerStub : public GuidanceStubDefault throw DBus::ErrorFailed("guidance already active"); } mp_guidance=new GuidanceObj(this, _sessionHandle, _routeHandle); + fireGuidanceStatusChangedEvent(Guidance::GuidanceStatus::ACTIVE, _routeHandle); _reply(); } @@ -237,8 +238,12 @@ class GuidanceServerStub : public GuidanceStubDefault dbg(lvl_debug,"no guidance active\n"); throw DBus::ErrorFailed("no guidance active"); } + Guidance::GuidanceStatus _guidanceStatus; + NavigationTypes::Handle _routeHandle; + mp_guidance->GetGuidanceStatus(_guidanceStatus,_routeHandle); delete(mp_guidance); - mp_guidance=NULL; + mp_guidance = NULL; + fireGuidanceStatusChangedEvent(Guidance::GuidanceStatus::INACTIVE, _routeHandle); _reply(); } @@ -752,24 +757,23 @@ GuidanceObj::GuidanceObj(GuidanceServerStub *guidance, uint32_t SessionHandle, u if (navit_get_attr(navit, attr_callback_list, &callback_list, NULL)) { callback_list_call_attr_4(callback_list.u.callback_list, attr_command, "navit_genivi_get_route", in, &ret, NULL); if (ret && ret[0] && ret[1] && ret[0]->type == attr_route && ret[1]->type == attr_vehicleprofile) { - struct tracking *tracking=get_tracking(); + struct tracking *tracking=get_tracking(); m_route=*ret[0]; m_vehicleprofile=*ret[1]; m_tracking_callback.u.callback=callback_new_attr_1(reinterpret_cast(GuidanceObj_TrackingCallback), attr_position_coord_geo, this); - tracking_add_attr(tracking, &m_tracking_callback); - struct vehicle *demo=get_vehicle("demo:"); - if (demo) { - vehicle_set_attr(demo, &m_route); - vehicle_set_attr(demo, &vehicle_speed); + tracking_add_attr(tracking, &m_tracking_callback); + struct vehicle *demo=get_vehicle("demo:"); + if (demo) { + vehicle_set_attr(demo, &m_route); + vehicle_set_attr(demo, &vehicle_speed); } navigation_set_route(get_navigation(), m_route.u.route); - tracking_set_route(get_tracking(), m_route.u.route); - navigation_register_callback(get_navigation(), attr_navigation_speech, m_guidance_callback); - GuidanceObj_Callback(this); - } + tracking_set_route(get_tracking(), m_route.u.route); + navigation_register_callback(get_navigation(), attr_navigation_speech, m_guidance_callback); + GuidanceObj_Callback(this); + } g_free(ret); } - m_guidance->fireGuidanceStatusChangedEvent(Guidance::GuidanceStatus::ACTIVE, RouteHandle); } GuidanceObj::~GuidanceObj() @@ -784,7 +788,6 @@ GuidanceObj::~GuidanceObj() navigation_unregister_callback(get_navigation(), attr_navigation_speech, m_guidance_callback); callback_destroy(m_guidance_callback); } - m_guidance->fireGuidanceStatusChangedEvent(Guidance::GuidanceStatus::INACTIVE, 0); #if (SPEECH_ENABLED) delete(m_speechoutput); #endif diff --git a/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt index 5610143..5cee666 100644 --- a/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIBDIR}/libdbus-1.so) diff --git a/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt index 3526409..1251da4 100644 --- a/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt index 5ac8680..dee705b 100644 --- a/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt index ecbdb8b..c8d0a5b 100644 --- a/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt @@ -31,7 +31,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt index 5c3652b..680f83c 100644 --- a/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt @@ -30,7 +30,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) # DBus Path if(DBUS_LIB_PATH) - message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) diff --git a/src/navigation/run-capi b/src/navigation/run-capi new file mode 100755 index 0000000..4a5a7a0 --- /dev/null +++ b/src/navigation/run-capi @@ -0,0 +1,203 @@ +#!/bin/bash + +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen +# +# \file run +# +# \brief This file is part of the Build System. +# +# \author Martin Schaller +# +# \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: +# +# 26-6-2014, Marco Residori, Added support of new EnhancedPositionService +# 4-8-2014, Philippe Colliot, Add some wait for dbus service +# +# @licence end@ +########################################################################### +function run +{ + local x=$xterm + local g=$gdb + local l=$log + local title="$1" + shift + if [ "$1" = "-n" ] + then + shift + x=0 + log=0 + fi + if [ "$1" = -"g" ] + then + shift + g=0 + fi + if [ "$x" = 1 ] + then + if [ "$g" = 1 ] + then + set -- gdb -ex run --args "$@" + fi + xterm -T "$title" -sb -sl 5000 -e "$@" & + elif [ "$log" = 1 ] + then + "$@" >"$CUR_DIR/$title.log" 2>&1 & + else + "$@" & + fi + PIDS="$PIDS $!" +} + +function wait_for_service +{ + for i in $(seq 1 50) + do + if dbus-send --dest=$1 $2 org.freedesktop.DBus.Introspectable.Introspect + then + return + fi + echo "Waiting for $1" + sleep 0.1 + done +} + +function terminate +{ + set +e + trap "" EXIT INT + kill $PIDS +} + +gdb=0 +xterm=0 +log=0 +enhpos=1 +replayer=1 +verbose=0 #no debug or log messages displayed +center="4612 N 0608 E" + +CUR_DIR=$PWD +BIN_DIR=$CUR_DIR/bin +SRC_DIR=$PWD +LOGREPLAYER_LOGS_DIR=$SRC_DIR/positioning/log-replayer/logs +NAVIT_BIN_DIR=$CUR_DIR/build/navit/navit/ + +while getopts c:gnorvx opt +do + case $opt in + c) + case "$OPTARG" in + paris) + center="2.34 48.86" + ;; + tokyo) + center="139.74 35.70" + ;; + [0-9-]*) + center=$OPTARG + ;; + *) + echo "Unsupported center $OPTARG" >&2 + exit 1 + ;; + esac + ;; + g) + gdb=1 + ;; + n) + enhpos=0 + ;; + o) + log=1 + ;; + r) + replayer=0 + ;; + v) #enable log messages + verbose=1 + ;; + x) + xterm=1 + ;; + \?) + echo "Usage:" + echo "$0 [-c center][-gnorvx]" + echo "-c: Set center (supported values: paris,tokyo,longitude,latitude). Default is geneve" + echo "-g: Run subprocesses within gdb (only with -x)" + echo "-n: Don't start enhanced-position-service" + echo "-r: Don't start replayer" + echo "-o: Create log file of subprocess output" + echo "-v: Enable the output debug messages" + echo "-x: Run subprocesses in own xterm to get separated log messages" + exit 1 + esac +done +trap "terminate" EXIT INT +set -e + +echo "the graphic for navit is based on sdl" +export NAVIT_GRAPHICS='sdl' + +cd $BIN_DIR + +if [ "$enhpos" = 1 ] +then + run EnhancedPositionService ./EnhancedPositionServiceDBus + wait_for_service org.genivi.EnhancedPositionService.EnhancedPosition_EnhancedPositionService /EnhancedPositionService + + if [ "$replayer" = 1 ] + then + if [ -z "$REPLAYER_LOG_FILE" ] + then + REPLAYER_LOG_FILE=$LOGREPLAYER_LOGS_DIR/geneve-cologny.log + fi + run LogReplayer ./log-replayer $REPLAYER_LOG_FILE + fi +fi + +cd $NAVIT_BIN_DIR + +>bookmark.txt +echo "$center" >center.txt + +if [ "$verbose" = "1" ] +then + run MapViewer ./navit -d 3 -c navit_genivi_mapviewer.xml +else + run MapViewer ./navit -d 0 -c navit_genivi_mapviewer.xml +fi + +wait_for_service org.genivi.navigation.mapviewer.Configuration_Configuration /org/genivi/navigation/mapviewer +wait_for_service org.genivi.navigation.mapviewer.MapViewerControl_MapViewerControl /org/genivi/navigation/mapviewer +wait_for_service org.genivi.navigation.mapviewer.Session_Session /org/genivi/navigation/mapviewer + +if [ "$verbose" = "1" ] +then + run NavigationCore ./navit -d 3 -c navit_genivi_navigationcore.xml +else + run NavigationCore ./navit -d 0 -c navit_genivi_navigationcore.xml +fi + +wait_for_service org.genivi.navigation.navigationcore.Configuration_Configuration /org/genivi/navigation/navigationcore +wait_for_service org.genivi.navigation.navigationcore.Guidance_Guidance /org/genivi/navigation/navigationcore +wait_for_service org.genivi.navigation.navigationcore.LocationInput_LocationInput /org/genivi/navigation/navigationcore +wait_for_service org.genivi.navigation.navigationcore.MapMatchedPosition_MapMatchedPosition /org/genivi/navigation/navigationcore +wait_for_service org.genivi.navigation.navigationcore.Routing_Routing /org/genivi/navigation/navigationcore +wait_for_service org.genivi.navigation.navigationcore.Session_Session /org/genivi/navigation/navigationcore + +wait -- cgit v1.2.1