summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2016-07-05 05:56:33 +0200
committerasanoaozora <fifitaneki@hotmail.com>2016-07-05 05:56:33 +0200
commit6412262adc39b2db08ca27d0030c7103cb23a5fb (patch)
tree52214726740e0527970dd4661f8f1737ac26c9d0
parent85ea9e487e096e8c0ffc8f3469c9aaad27e2a7cd (diff)
downloadpoi-service-6412262adc39b2db08ca27d0030c7103cb23a5fb.tar.gz
some updates of Franca files
-rw-r--r--api/franca/navigation/mapviewer/Configuration.fidl (renamed from api/franca/navigation/mapviewer/MapViewerConfiguration.fidl)0
-rw-r--r--api/franca/navigation/navigationcore/Configuration.fidl (renamed from api/franca/navigation/navigationcore/NavigationCoreConfiguration.fidl)0
-rw-r--r--api/franca/navigation/navigationcore/Session.fidl (renamed from api/franca/navigation/navigationcore/NavigationCoreSession.fidl)0
-rw-r--r--api/franca/navigation/poiservice/POIConfiguration.fidl8
-rw-r--r--api/franca/navigation/poiservice/POIContentAccess.fidl (renamed from api/franca/navigation/poiservice/ServiceContentAccess.fidl)0
-rw-r--r--api/franca/navigation/poiservice/POIContentAccessModule.fidl (renamed from api/franca/navigation/poiservice/ContentAccessModule.fidl)2
-rw-r--r--api/franca/navigation/poiservice/POIServiceTypes.fidl9
-rw-r--r--src/navigation/CMakeLists.txt5
-rwxr-xr-xsrc/navigation/build.sh47
-rw-r--r--src/navigation/navigation-core/CMakeLists.txt1
-rw-r--r--src/navigation/navigation-core/navit_genivi_navigationcore_capi.xsl2
-rw-r--r--src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt121
-rw-r--r--src/navigation/navigation-core/poicam-server-plugin/genivi_poiservice_cam_navit.cxx450
-rw-r--r--src/navigation/navigation-core/routing-server-plugin/genivi_navigationcore_routing.cxx2
-rw-r--r--src/navigation/navigation-core/session-server-plugin/CMakeLists.txt3
-rwxr-xr-xtest/navigation/test-location-input-capi.py50
-rwxr-xr-xtest/navigation/test-route-calculation-capi.py214
-rw-r--r--test/poi-service/poi-manager-client/README.md4
-rw-r--r--test/poi-service/poi-manager-client/commonapi-dbus.ini5
-rw-r--r--test/poi-service/poi-manager-client/commonapi4dbus.ini4
20 files changed, 884 insertions, 43 deletions
diff --git a/api/franca/navigation/mapviewer/MapViewerConfiguration.fidl b/api/franca/navigation/mapviewer/Configuration.fidl
index c56c687..c56c687 100644
--- a/api/franca/navigation/mapviewer/MapViewerConfiguration.fidl
+++ b/api/franca/navigation/mapviewer/Configuration.fidl
diff --git a/api/franca/navigation/navigationcore/NavigationCoreConfiguration.fidl b/api/franca/navigation/navigationcore/Configuration.fidl
index 1aa15d0..1aa15d0 100644
--- a/api/franca/navigation/navigationcore/NavigationCoreConfiguration.fidl
+++ b/api/franca/navigation/navigationcore/Configuration.fidl
diff --git a/api/franca/navigation/navigationcore/NavigationCoreSession.fidl b/api/franca/navigation/navigationcore/Session.fidl
index c136000..c136000 100644
--- a/api/franca/navigation/navigationcore/NavigationCoreSession.fidl
+++ b/api/franca/navigation/navigationcore/Session.fidl
diff --git a/api/franca/navigation/poiservice/POIConfiguration.fidl b/api/franca/navigation/poiservice/POIConfiguration.fidl
index bcad95b..1507a92 100644
--- a/api/franca/navigation/poiservice/POIConfiguration.fidl
+++ b/api/franca/navigation/poiservice/POIConfiguration.fidl
@@ -24,14 +24,6 @@ interface POIConfiguration {
Version ^version
}
}
- <** @description: Settings**>
- enumeration Settings {
- INVALID = 0
- UNITS_OF_MEASUREMENT = 48 //Base 0x0030
- LOCALE = 37
- TIME_FORMAT = 3
- COORDINATES_FORMAT = 6
- }
<** @description: Units of measurement**>
enumeration UnitsOfMeasurementAttribute {
diff --git a/api/franca/navigation/poiservice/ServiceContentAccess.fidl b/api/franca/navigation/poiservice/POIContentAccess.fidl
index 29101a3..29101a3 100644
--- a/api/franca/navigation/poiservice/ServiceContentAccess.fidl
+++ b/api/franca/navigation/poiservice/POIContentAccess.fidl
diff --git a/api/franca/navigation/poiservice/ContentAccessModule.fidl b/api/franca/navigation/poiservice/POIContentAccessModule.fidl
index a2256f5..61c3632 100644
--- a/api/franca/navigation/poiservice/ContentAccessModule.fidl
+++ b/api/franca/navigation/poiservice/POIContentAccessModule.fidl
@@ -207,7 +207,7 @@ interface POIContentAccessModule {
broadcast ConfigurationChanged {
out {
<** @description : changedSettings array[setting].**>
- UInt16[] changedSettings
+ Settings[] changedSettings
}
}
diff --git a/api/franca/navigation/poiservice/POIServiceTypes.fidl b/api/franca/navigation/poiservice/POIServiceTypes.fidl
index a57f27d..44f851b 100644
--- a/api/franca/navigation/poiservice/POIServiceTypes.fidl
+++ b/api/franca/navigation/poiservice/POIServiceTypes.fidl
@@ -108,6 +108,15 @@ typeCollection POIServiceTypes {
LOCALES
}
+ <** @description: Settings**>
+ enumeration Settings {
+ INVALID = 0
+ UNITS_OF_MEASUREMENT = 48 //Base 0x0030
+ LOCALE = 37
+ TIME_FORMAT = 3
+ COORDINATES_FORMAT = 6
+ }
+
<** @description: Different types of resources for icons**>
union Icon {
ResourceID[] id
diff --git a/src/navigation/CMakeLists.txt b/src/navigation/CMakeLists.txt
index f8a7ef4..d45974f 100644
--- a/src/navigation/CMakeLists.txt
+++ b/src/navigation/CMakeLists.txt
@@ -122,5 +122,6 @@ add_subdirectory(navigation-core)
add_subdirectory(map-viewer)
-add_subdirectory(poi-cam)
-
+if (NOT WITH_PLUGIN_MIGRATION)
+ add_subdirectory(poi-cam)
+endif()
diff --git a/src/navigation/build.sh b/src/navigation/build.sh
index e91a68b..c36b681 100755
--- a/src/navigation/build.sh
+++ b/src/navigation/build.sh
@@ -1,21 +1,55 @@
#!/bin/bash
clean=0
+capi=0
-while getopts c opt
+function check_path_for_capi
+{
+ if [ ! $COMMONAPI_TOOL_DIR ]
+ then
+ echo 'Set the dir of the common api tools'
+ echo 'export COMMONAPI_TOOL_DIR=<path>'
+ exit 1
+ fi
+
+ if [ ! $COMMONAPI_DBUS_TOOL_DIR ]
+ then
+ echo 'Set the dir of the common api dbus tools'
+ echo 'export COMMONAPI_DBUS_TOOL_DIR=<path>'
+ exit 1
+ fi
+
+ if [ ! $DBUS_LIB_PATH ]
+ then
+ echo 'Set the dir of the patched dbus'
+ echo 'export DBUS_LIB_PATH=<path>'
+ exit 1
+ fi
+}
+
+while getopts cm opt
do
case $opt in
c)
clean=1
;;
+ m)
+ capi=1
+ ;;
\?)
echo "Usage:"
- echo "$0 [-c ]"
- echo "-c: Rebuild with clean"
+ echo "$0 [-c] [-m]"
+ echo "-c: build with clean"
+ echo "-m: build with commonAPI plugins "
exit 1
esac
done
+if [ "$capi" = 1 ]
+then
+ check_path_for_capi
+fi
+
if [ "$clean" = 1 ]
then
echo 'clean up the build folder'
@@ -39,7 +73,12 @@ cd ../
echo 'build navigation'
if [ "$clean" = 1 ]
then
- cmake ../
+ if [ "$capi" = 0 ]
+ 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 ../
+ fi
fi
make
cd ..
diff --git a/src/navigation/navigation-core/CMakeLists.txt b/src/navigation/navigation-core/CMakeLists.txt
index 819f89b..986d61d 100644
--- a/src/navigation/navigation-core/CMakeLists.txt
+++ b/src/navigation/navigation-core/CMakeLists.txt
@@ -100,6 +100,7 @@ if (WITH_PLUGIN_MIGRATION)
add_subdirectory(mapmatchedposition-server-plugin)
add_subdirectory(routing-server-plugin)
add_subdirectory(session-server-plugin)
+ add_subdirectory(poicam-server-plugin)
else()
add_subdirectory(configuration-plugin)
add_subdirectory(locationinput-plugin)
diff --git a/src/navigation/navigation-core/navit_genivi_navigationcore_capi.xsl b/src/navigation/navigation-core/navit_genivi_navigationcore_capi.xsl
index 68cd29d..d2dde47 100644
--- a/src/navigation/navigation-core/navit_genivi_navigationcore_capi.xsl
+++ b/src/navigation/navigation-core/navit_genivi_navigationcore_capi.xsl
@@ -37,7 +37,7 @@
<xsl:text>&#x0A; </xsl:text>
<plugin path="../../navigation-core/enhancedposition-plugin/.libs/libgenivi_positioning_enhancedposition.so" ondemand="no"/>
<xsl:text>&#x0A; </xsl:text>
- <plugin path="../../poi-cam/.libs/libgenivi_poiservice_cam_navit.so" ondemand="no"/>
+ <plugin path="../../navigation-core/poicam-server-plugin/.libs/libgenivi_poiservice_cam_server.so" ondemand="no"/>
</xsl:template>
<xsl:template match="/config/plugins/plugin">
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
diff --git a/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt
new file mode 100644
index 0000000..64af8bc
--- /dev/null
+++ b/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt
@@ -0,0 +1,121 @@
+###########################################################################
+# @licence app begin@
+# SPDX-License-Identifier: MPL-2.0
+#
+# Component Name: configuration-server-plugin
+#
+# Author: Philippe Colliot
+#
+# Copyright (C) 2015, PCA Peugeot Citroën
+#
+# License:
+# This Source Code Form is subject to the terms of the
+# Mozilla Public License, 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/.
+#
+# @licence end@
+###########################################################################
+project(poicam-server-plugin)
+cmake_minimum_required(VERSION 2.8)
+
+message(STATUS ${PROJECT_NAME})
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_CXX_FLAGS "-Wall -std=c++0x")
+
+
+
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
+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)
+else()
+ message(FATAL_ERROR "Please specify the path to your patched DBus library using -DDBUS_LIB_PATH=yourPath")
+endif()
+
+# Packages
+find_package(CommonAPI 3.1.5 REQUIRED)
+find_package(CommonAPI-DBus 3.1.5 REQUIRED)
+
+
+#pkg_check_modules(DBUS "dbus-1 >= 1.8.4") // #to be fixed, it doesn't work so the paths are set manually (see above)
+pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.5")
+pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1.5")
+pkg_check_modules(GOBJECT gobject-2.0)
+pkg_check_modules(GLIB REQUIRED glib-2.0)
+pkg_check_modules(DBUS_CPP_GLIB dbus-c++-glib-1)
+
+
+# Add the Franca files (that will generate the CommonAPI stuff)
+set(COMMONAPI_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/src-gen")
+add_subdirectory(${FRANCA_DIR}/navigation/poiservice "${CMAKE_CURRENT_BINARY_DIR}/franca")
+
+# Path to the generated files
+set(API_VERSION_MAJOR 4)
+set(API_VERSION "v${API_VERSION_MAJOR}")
+set(PRJ_SRC_GEN_ROOT_PATH ${COMMONAPI_GEN_DIR}/${API_VERSION}/org/genivi) #files shared by all the APIs
+set(PRJ_SRC_GEN_NAVIGATION_PATH ${PRJ_SRC_GEN_ROOT_PATH}/navigation) #files shared by the navigation APIs
+set(PRJ_SRC_GEN_POISERVICE_PATH ${PRJ_SRC_GEN_NAVIGATION_PATH}/poiservice) #files shared by the poiservice APIs
+
+# Source Files
+FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cxx)
+# Source Files for generating the server stub
+set(FRANCA_FILE_SERVER "POIContentAccessModule")
+FILE(GLOB PRJ_STUB_GEN_SRCS
+ ${PRJ_SRC_GEN_ROOT_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*Types.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*StubDefault.cpp
+ ${PRJ_SRC_GEN_NAVIGATION_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_NAVIGATION_PATH}/*Types.cpp ${PRJ_SRC_GEN_NAVIGATION_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_NAVIGATION_PATH}/*StubDefault.cpp
+ ${PRJ_SRC_GEN_POISERVICE_PATH}/${FRANCA_FILE_SERVER}DBusStub*.cpp ${PRJ_SRC_GEN_POISERVICE_PATH}/${FRANCA_FILE_SERVER}Types.cpp ${PRJ_SRC_GEN_POISERVICE_PATH}/${FRANCA_FILE_SERVER}DBusDeployment.cpp ${PRJ_SRC_GEN_POISERVICE_PATH}/${FRANCA_FILE_SERVER}StubDefault.cpp
+ )
+FILE(GLOB PRJ_STUB_IMPL_SRCS
+ ${PRJ_SRC_GEN_ROOT_PATH}/*Stub*.cpp
+ ${PRJ_SRC_GEN_NAVIGATION_PATH}/*Stub*.cpp
+ ${PRJ_SRC_GEN_POISERVICE_PATH}/${FRANCA_FILE_SERVER}Stub*.cpp
+ )
+set(FRANCA_FILE_CLIENT "POIContentAccess")
+FILE(GLOB PRJ_PROXY_GEN_SRCS
+ ${PRJ_SRC_GEN_POISERVICE_PATH}/${FRANCA_FILE_CLIENT}DBusClient*.cpp
+)
+
+set(PRJ_SRCS ${PRJ_LOCAL_SRCS} ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS} ${PRJ_PROXY_GEN_SRCS})
+
+include_directories(
+ ${COMMONAPI_GEN_DIR}
+ ${PRJ_SRC_GEN_ROOT_PATH}
+ ${PRJ_SRC_GEN_NAVIGATION_PATH}
+ ${PRJ_SRC_GEN_POISERVICE_PATH}
+ ${DBUS_INCLUDE_DIRS}
+ ${COMMONAPI_INCLUDE_DIRS}
+ ${COMMONAPI_DBUS_INCLUDE_DIRS}
+ ${GOBJECT_INCLUDE_DIRS}
+ ${GLIB_INCLUDE_DIRS}
+ ${DBUS_CPP_GLIB_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${DBUS_LIBDIR}
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+ ${GOBJECT_LIBRARY_DIRS}
+ ${GLIB_LIBRARY_DIRS}
+ ${DBUS_CPP_GLIB_DIRS}
+)
+
+set(LIBRARIES
+ ${DBUS_LIBRARIES}
+ ${COMMONAPI_LIBRARIES}
+ ${COMMONAPI_DBUS_LIBRARIES}
+ ${GOBJECT_LIBRARIES}
+ ${GLIB_LIBRARIES}
+ ${DBUS_CPP_GLIB_LIBRARIES}
+)
+
+# Build service
+module_add_library(genivi_poiservice_cam_server ${PRJ_SRCS})
+target_link_libraries(genivi_poiservice_cam_server ${LIBRARIES})
+
diff --git a/src/navigation/navigation-core/poicam-server-plugin/genivi_poiservice_cam_navit.cxx b/src/navigation/navigation-core/poicam-server-plugin/genivi_poiservice_cam_navit.cxx
new file mode 100644
index 0000000..fcf49ed
--- /dev/null
+++ b/src/navigation/navigation-core/poicam-server-plugin/genivi_poiservice_cam_navit.cxx
@@ -0,0 +1,450 @@
+/**
+* @licence app begin@
+* SPDX-License-Identifier: MPL-2.0
+*
+* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
+*
+* \file genivi_poiservice_cam_navit.cxx
+*
+* \brief This file is part of the Navit POC.
+*
+* \author Martin Schaller <martin.schaller@it-schaller.de>
+* \author Philippe Colliot <philippe.colliot@mpsa.com>
+*
+* \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:
+*
+* <date>, <name>, <description of change>
+*
+* @licence end@
+*/
+#include <dbus-c++/glib-integration.h>
+#include "config.h"
+#define USE_PLUGINS 1
+#include "debug.h"
+#include "plugin.h"
+#include "item.h"
+#include "config_.h"
+#include "navit.h"
+#include "search.h"
+#include "callback.h"
+#include "event.h"
+#include "coord.h"
+#include "transform.h"
+#include "map.h"
+#include "mapset.h"
+#include <algorithm>
+#include <unistd.h>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include <CommonTypes.hpp>
+#include <NavigationTypes.hpp>
+#include <POIContentAccessModuleStubDefault.hpp>
+#include <POIContentAccessProxy.hpp>
+
+#if (!DEBUG_ENABLED)
+#undef dbg
+#define dbg(level,...) ;
+#endif
+
+using namespace v4::org::genivi::navigation::poiservice;
+using namespace v4::org::genivi::navigation;
+using namespace v4::org::genivi;
+
+static bool
+do_sort_distance(POIServiceTypes::PoiCAMDetails a, POIServiceTypes::PoiCAMDetails b)
+{
+ return a.getDistance() < b.getDistance();
+}
+
+static std::shared_ptr<POIContentAccessProxyDefault> myServicePOIContentAccess;
+
+class POIContentAccessModuleServerStub : public POIContentAccessModuleStubDefault
+{
+public:
+
+#define MAX_POI_SEARCH_SIZE 256
+
+POIContentAccessModuleServerStub()
+{
+ m_version.setVersionMajor(3);
+ m_version.setVersionMinor(0);
+ m_version.setVersionMicro(0);
+ m_version.setDate("21-01-2014");
+
+ NavigationTypes::Locale en_US { "eng","USA", "Latn" };
+ NavigationTypes::Locale fr_FR { "fra","FRA", "Latn" };
+ NavigationTypes::Locale de_DE { "deu","DEU", "Latn" };
+ NavigationTypes::Locale jp_JP { "jpn","JPN", "Hrkt" };
+
+ m_SupportedLocales.push_back(en_US);
+ m_SupportedLocales.push_back(fr_FR);
+ m_SupportedLocales.push_back(de_DE);
+ m_SupportedLocales.push_back(jp_JP);
+
+ m_languageCode = m_SupportedLocales.at(0).getLanguageCode();
+ m_countryCode = m_SupportedLocales.at(0).getCountryCode();
+ m_scriptCode = m_SupportedLocales.at(0).getScriptCode();
+
+ m_mapset=NULL;
+ m_msh=NULL;
+ m_map_rect=NULL;
+}
+
+/**
+ * description: This method returns the API version implemented by the content access module.
+ */
+void getVersion(const std::shared_ptr<CommonAPI::ClientId> _client, getVersionReply_t _reply){
+ _reply(m_version);
+}
+
+/**
+ * description: Set the current language set for the search by poi provider module. The
+ * language defines the poi and categories name and details language. If the
+ * language is not supported, the default details will be returned in the native
+ * language.
+ */
+void setLocale(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _languageCode, std::string _countryCode, std::string _scriptCode, setLocaleReply_t _reply){
+ std::vector<POIServiceTypes::Settings> changedSettings;
+
+ m_languageCode = _languageCode;
+ m_countryCode = _countryCode;
+ m_scriptCode = _scriptCode;
+
+ m_maxSize = MAX_POI_SEARCH_SIZE;
+
+ changedSettings.push_back(POIServiceTypes::Settings::LOCALE);
+
+ fireConfigurationChangedEvent(changedSettings);
+}
+
+/**
+ * description: Get the current language set for the search by poi provider module.
+ */
+void getLocale(const std::shared_ptr<CommonAPI::ClientId> _client, getLocaleReply_t _reply){
+ _reply(m_languageCode,m_countryCode,m_scriptCode);
+}
+
+/**
+ * description: Get the supported set of locales for the search by poi provider module.
+ */
+void getSupportedLocales(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedLocalesReply_t _reply){
+ _reply(m_SupportedLocales);
+}
+
+/**
+ * description: This method retrieves the list od POI categories available (pre-defined and
+ * custom).
+ */
+void getAvailableCategories(const std::shared_ptr<CommonAPI::ClientId> _client, getAvailableCategoriesReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Get the root category id. That would be ALL_CATEGORIES.
+ */
+void getRootCategory(const std::shared_ptr<CommonAPI::ClientId> _client, getRootCategoryReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Get the children categories id and type (top level) from the a parent unique id.
+ */
+void getChildrenCategories(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::CommonTypes::CategoryID _category, getChildrenCategoriesReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Get the parent categories id and type (top level) from the a unique id.
+ */
+void getParentCategories(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::CommonTypes::CategoryID _category, getParentCategoriesReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Creates a category by name and return an unique id.
+ */
+void createCategory(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::navigation::poiservice::POIServiceTypes::CAMCategory _category, createCategoryReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Removes a list of categories. Because of required time to remove it from the
+ * database, a signal is emitted when the deletion is done.
+ */
+void removeCategories(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector< ::v4::org::genivi::CommonTypes::CategoryID> _categories, removeCategoriesReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Adds a list of POIs to a category. Because of required time to add it to the
+ * database, a signal is emitted when the update is done, that gives the id of
+ * the elements added
+ */
+void addPOIs(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::CommonTypes::CategoryID _unique_id, std::vector< ::v4::org::genivi::navigation::poiservice::POIServiceTypes::PoiAddedDetails> _poiList, addPOIsReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: Removes a list of POIs to a category. Because of required time to remove it
+ * from the database, a signal is emitted when the update is done.
+ */
+void removePOIs(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector< ::v4::org::genivi::navigation::poiservice::POIServiceTypes::POI_ID> _ids, removePOIsReply_t _reply){
+ throw DBus::ErrorNotSupported("Not yet supported");
+}
+
+/**
+ * description: This method is sent by the POI service component to inform all the CAM that a
+ * new POI search was started. It provides all the relevant search
+ * parameters. Of course the CAM will only be aware of the search if it registers
+ * one of the search categories.
+ */
+void poiSearchStarted(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::navigation::NavigationTypes::Handle _poiSearchHandle, uint16_t _maxSize, ::v4::org::genivi::navigation::NavigationTypes::Coordinate3D _location, std::vector< ::v4::org::genivi::navigation::poiservice::POIServiceTypes::CategoryAndRadius> _poiCategories, std::vector< ::v4::org::genivi::navigation::poiservice::POIServiceTypes::AttributeDetails> _poiAttributes, std::string _inputString, ::v4::org::genivi::navigation::poiservice::POIServiceTypes::SortOption _sortOption, poiSearchStartedReply_t _reply){
+ struct attr navit;
+ struct coord_geo g;
+ dbg(lvl_debug,"enter handle=%d size=%d location=%f,%f,%d string='%s' sortOption=%d\n",_poiSearchHandle, _maxSize, _location.getLatitude(),_location.getLongitude(),_location.getAltitude(), _inputString.c_str(), _sortOption);
+ m_maxSize = _maxSize;
+ m_resultList.resize(0);
+ m_max_radius=0;
+ for (size_t i = 0 ; i < _poiCategories.size(); i++) {
+ dbg(lvl_debug,"category %d %d\n",_poiCategories[i].getId(),_poiCategories[i].getRadius());
+ if (m_max_radius < _poiCategories[i].getRadius())
+ m_max_radius=_poiCategories[i].getRadius();
+ }
+ for (size_t i = 0 ; i < _poiAttributes.size(); i++) {
+ dbg(lvl_debug,"attribute %d %d %d %d %d\n",_poiAttributes[i].getId(), _poiAttributes[i].getCategoryId(), _poiAttributes[i].getType(), _poiAttributes[i].getValue(), _poiAttributes[i].getOper());
+ }
+ dbg(lvl_debug,"max radius %d\n",m_max_radius);
+ if (!m_mapset) {
+ if (!config_get_attr(config, attr_navit, &navit, NULL)) {
+ dbg(lvl_debug,"failed to get navit\n");
+ return;
+ }
+ m_mapset=navit_get_mapset(navit.u.navit);
+ }
+ dbg(lvl_debug,"mapset %p\n",m_mapset);
+ g.lat=_location.getLatitude();
+ g.lng=_location.getLongitude();
+ transform_from_geo(projection_mg, &g, &m_center);
+ dbg(lvl_debug,"c 0x%x,0x%x\n",m_center.x,m_center.y);
+ m_scale=transform_scale(m_center.y);
+ int d=m_max_radius*10/m_scale;
+ m_selection.next=NULL;
+ m_selection.u.c_rect.rl=m_center;
+ m_selection.u.c_rect.rl.x+=d;
+ m_selection.u.c_rect.rl.y-=d;
+ m_selection.u.c_rect.lu=m_center;
+ m_selection.u.c_rect.lu.x-=d;
+ m_selection.u.c_rect.lu.y+=d;
+ m_selection.order=18;
+ m_selection.range.min=type_poi_fuel;
+ m_selection.range.max=type_poi_fuel;
+ dbg(lvl_debug,"rect 0x%x,0x%x-0x%x,0x%x\n",m_selection.u.c_rect.lu.x,m_selection.u.c_rect.lu.y,m_selection.u.c_rect.rl.x,m_selection.u.c_rect.rl.y);
+ if (m_msh)
+ mapset_close(m_msh);
+ m_msh=mapset_open(m_mapset);
+ map_next();
+ if (_sortOption == POIServiceTypes::SortOption::SORT_BY_DISTANCE)
+ m_sort_func=do_sort_distance;
+ else
+ m_sort_func=NULL;
+
+}
+
+/**
+ * description: This method cancels the search for the current id.
+ */
+void poiSearchCanceled(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::navigation::NavigationTypes::Handle _poiSearchHandle, poiSearchCanceledReply_t _reply){
+ dbg(lvl_debug,"enter\n");
+}
+
+/**
+ * description: This method provides the poi results list found by the CAM. As the POI
+ * unique id is managed by the POI component, the CAM only provides the POI name,
+ * the category and coordinates as well as all the relevant detailed information.
+ */
+void resultListRequested(const std::shared_ptr<CommonAPI::ClientId> _client, ::v4::org::genivi::navigation::poiservice::POIServiceTypes::ContentAccessModuleID _camId, ::v4::org::genivi::navigation::NavigationTypes::Handle _poiSearchHandle, std::vector< ::v4::org::genivi::navigation::poiservice::POIServiceTypes::AttributeID> _attributeList, resultListRequestedReply_t _reply){
+ struct item *item;
+ int count=0;
+ POIServiceTypes::SearchStatusState _statusValue;
+ std::vector<POIServiceTypes::PoiAttribute> attributeList;
+
+ m_resultList.clear();
+ dbg(lvl_debug,"enter camId=%d handle=%d\n", _camId, _poiSearchHandle);
+ while (m_resultList.size() < m_maxSize && m_map_rect) {
+ while (m_resultList.size() < m_maxSize && (item=map_rect_get_item(m_map_rect))) {
+ if (item->type == type_poi_fuel)
+ {
+ struct attr label;
+ struct coord c;
+ dbg(lvl_debug,"adding poi\n");
+ POIServiceTypes::PoiCAMDetails result;
+ POIServiceTypes::PoiAttribute attribute;
+ NavigationTypes::Coordinate3D location;
+ result.setSourceId(m_resultList.size());
+ if (item_attr_get(item, attr_label, &label))
+ result.setName(std::string(label.u.str));
+ else
+ result.setName(std::string(""));
+ result.setCategory(m_poiCategoriesId[0]);
+ if (item_coord_get(item, &c, 1)) {
+ struct coord_geo g;
+ transform_to_geo(projection_mg, &c, &g);
+ location.setLatitude(g.lat);
+ location.setLongitude(g.lng);
+ location.setAltitude(0);
+ result.setLocation(location);
+ double distance=transform_distance(projection_mg, &m_center, &c)/m_scale;
+ #if 0
+ if (distance > m_max_radius)
+ return;
+ #endif
+ result.setDistance(distance);
+ } else {
+ location.setLatitude(0);
+ location.setLongitude(0);
+ location.setAltitude(0);
+ result.setLocation(location);
+ result.setDistance(0);
+ }
+ /* result._6 attributes */
+ attribute.setId(0);
+ attribute.setType(POIServiceTypes::AttributeType::STRING);
+ attribute.setValue(std::string(""));
+ attributeList.push_back(attribute);
+ result.setAttributeList(attributeList);
+ m_resultList.push_back(result);
+ }
+ count++;
+ }
+ map_next();
+ }
+ dbg(lvl_debug,"got %d items\n",count);
+ _statusValue=POIServiceTypes::SearchStatusState::FINISHED;
+ if (m_sort_func)
+ std::sort(m_resultList.begin(), m_resultList.end(), m_sort_func);
+
+ _reply(_statusValue,m_resultList.size(),m_resultList);
+}
+
+/**
+ * description: This method retrieves the details associated to one or more POI. It
+ * contains the name, the parent categories, the list of attributes, the icons,
+ * ... .
+ */
+void poiDetailsRequested(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector< ::v4::org::genivi::navigation::poiservice::POIServiceTypes::POI_ID> _source_id, poiDetailsRequestedReply_t _reply){
+ dbg(lvl_debug,"enter\n");
+ std::vector< POIServiceTypes::SearchResultDetails> _results;
+ NavigationTypes::Coordinate3D location;
+ POIServiceTypes::PoiDetails details;
+ std::vector<POIServiceTypes::PoiAttribute> attributeList;
+ std::vector< CommonTypes::CategoryID > poiCategoriesId;
+ poiCategoriesId.push_back(m_poiCategoriesId[0]);
+ for (size_t i = 0 ; i < _source_id.size() ; i++) {
+ int sid=_source_id[i];
+ POIServiceTypes::SearchResultDetails result;
+ details.setId(sid);
+ details.setName(m_resultList[sid].getName());
+ location = m_resultList[sid].getLocation();
+ details.setLocation(location);
+ result.setDetails(details);
+ result.setCategories(poiCategoriesId);
+ _results.push_back(result);
+ }
+ _reply(_results);
+}
+
+void
+map_next(void)
+{
+ m_map=mapset_next(m_msh, 1);
+ if (m_map_rect)
+ map_rect_destroy(m_map_rect);
+ if (m_map)
+ m_map_rect=map_rect_new(m_map, &m_selection);
+ else
+ m_map_rect=NULL;
+}
+
+void
+register_cam(void)
+{
+ CommonAPI::CallStatus status;
+ POIServiceTypes::ContentAccessModuleID camId;
+
+ myServicePOIContentAccess->registerContentAccessModule(std::string("org.genivi.poiservice.POIContentAccessModuleNavit"),status,camId);
+ dbg(lvl_debug,"camid=%d\n",camId);
+
+ std::vector<POIServiceTypes::CAMCategory> poiCategories;
+ POIServiceTypes::CAMCategory poiCategory;
+ POIServiceTypes::Details poiDetails;
+ poiDetails.setIcons(std::string(""));
+ poiDetails.setName("fuel");
+ poiDetails.setMedia(std::string(""));
+ poiCategory.setDetails(poiDetails);
+ poiCategories.push_back(poiCategory);
+
+ myServicePOIContentAccess->addCategories(camId,poiCategories,status,m_poiCategoriesId);
+
+ myServicePOIContentAccess->registerPoiCategories(camId,m_poiCategoriesId,status);
+}
+
+private:
+
+ CommonTypes::Version m_version;
+ std::vector< CommonTypes::CategoryID > m_poiCategoriesId;
+ std::vector<POIServiceTypes::PoiCAMDetails> m_resultList;
+ uint32_t m_max_radius;
+ bool (*m_sort_func)(POIServiceTypes::PoiCAMDetails a, POIServiceTypes::PoiCAMDetails b);
+ struct coord m_center;
+ double m_scale;
+ struct mapset *m_mapset;
+ struct mapset_handle *m_msh;
+ struct map *m_map;
+ struct map_rect *m_map_rect;
+ struct map_selection m_selection;
+ std::vector< NavigationTypes::Locale> m_SupportedLocales;
+ std::string m_languageCode, m_countryCode, m_scriptCode;
+ uint16_t m_maxSize;
+
+};
+
+void
+plugin_init(void)
+{
+ dbg(lvl_debug,"enter\n");
+ event_request_system("glib","genivi_poiservice");
+
+ // Common API data init
+ std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get();
+
+ const std::string domain = "local";
+ const std::string instancePOIContentAccessModule = "POIContentAccessModuleService";
+
+ std::shared_ptr<POIContentAccessModuleServerStub> myServicePOIContentAccessModule = std::make_shared<POIContentAccessModuleServerStub>();
+
+ bool successfullyRegistered = runtime->registerService(domain, instancePOIContentAccessModule, myServicePOIContentAccessModule);
+ while (!successfullyRegistered) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ successfullyRegistered = runtime->registerService(domain, instancePOIContentAccessModule, myServicePOIContentAccessModule);
+ }
+
+ const std::string instancePOIContentAccess = "POIContentAccess";
+
+/* myServicePOIContentAccess = runtime->buildProxy<POIContentAccessProxy>(domain, instancePOIContentAccess);
+
+ while (!myServicePOIContentAccess->isAvailable()) {
+ usleep(10);
+ }
+
+ myServicePOIContentAccessModule->register_cam();
+*/
+}
diff --git a/src/navigation/navigation-core/routing-server-plugin/genivi_navigationcore_routing.cxx b/src/navigation/navigation-core/routing-server-plugin/genivi_navigationcore_routing.cxx
index 8bdaaea..ff97a77 100644
--- a/src/navigation/navigation-core/routing-server-plugin/genivi_navigationcore_routing.cxx
+++ b/src/navigation/navigation-core/routing-server-plugin/genivi_navigationcore_routing.cxx
@@ -933,6 +933,8 @@ RoutingObj::SetRoutePreferences(uint32_t sessionHandle, const std::string& count
par=&s->highway_land_weight;
active=RoutePreference(Routing::PreferenceMode::AVOID, Routing::RoutePreferenceSource::HIGHWAYS_MOTORWAYS);
break;
+ default:
+ break;
}
if (par) {
if (!*par) {
diff --git a/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt
index bb56781..ff085fd 100644
--- a/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt
+++ b/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt
@@ -24,7 +24,6 @@ set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_CXX_FLAGS "-Wall -std=c++0x")
-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
@@ -64,7 +63,7 @@ set(PRJ_SRC_GEN_NAVIGATION_PATH ${PRJ_SRC_GEN_ROOT_PATH}/navigation) #files shar
set(PRJ_SRC_GEN_NAVIGATIONCORE_PATH ${PRJ_SRC_GEN_NAVIGATION_PATH}/navigationcore) #files shared by the navigationcore APIs
# Source Files
-set(FRANCA_FILE "NavigationCoreSession")
+set(FRANCA_FILE "Session")
FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cxx)
FILE(GLOB PRJ_STUB_GEN_SRCS
${PRJ_SRC_GEN_ROOT_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*Types.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*StubDefault.cpp
diff --git a/test/navigation/test-location-input-capi.py b/test/navigation/test-location-input-capi.py
index 5f2f9fc..2f73f70 100755
--- a/test/navigation/test-location-input-capi.py
+++ b/test/navigation/test-location-input-capi.py
@@ -72,9 +72,9 @@ city_search_mode = 0
street_search_mode = 1 #set to full because of a bug to be fixed in the plug-in
house_number_search_mode = 1
-print '\n--------------------------\n' + \
+print( '\n--------------------------\n' + \
'LocationInput Test' + \
- '\n--------------------------\n'
+ '\n--------------------------\n')
parser = argparse.ArgumentParser(description='Location input Test for navigation PoC and FSA.')
parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format')
@@ -225,13 +225,13 @@ def spell_search(handle, entered_string, search_string, valid_characters, first=
location_input_interface.spell(dbus.UInt32(session_handle), dbus.UInt32(handle),
dbus.String(spell_character), dbus.UInt16(20))
else:
- print 'TEST FAILED (Target character can not be entered)'
+ print ('TEST FAILED (Target character can not be entered)')
loop.quit()
else:
- print 'TEST FAILED (Unexpected completion)'
+ print ('TEST FAILED (Unexpected completion)')
loop.quit()
else:
- print 'Full spell match'
+ print ('Full spell match')
# Full string search
@@ -249,39 +249,39 @@ def full_string_search(handle, search_string):
def evaluate_address(address, guidable):
test_passed = 0
- print '\nAddress complete!\nEvaluating...'
+ print ('\nAddress complete!\nEvaluating...')
if COUNTRY_STRING[current_address_index] == '':
test_passed = 1
elif address[COUNTRY][1] == COUNTRY_STRING[current_address_index]:
- print 'Country\t\t\t-> ok (' + address[COUNTRY][1] + ')'
+ print ('Country\t\t\t-> ok (' + address[COUNTRY][1] + ')')
if CITY_STRING[current_address_index] == '':
test_passed = 1
elif address[CITY][1] == CITY_STRING[current_address_index]:
- print 'City\t\t\t-> ok (' + address[CITY][1] + ')'
+ print ('City\t\t\t-> ok (' + address[CITY][1] + ')')
if STREET_STRING[current_address_index] == '':
test_passed = 1
elif address[STREET][1] == STREET_STRING[current_address_index]:
- print 'Street\t\t\t-> ok (' + address[STREET][1] + ')'
+ print ('Street\t\t\t-> ok (' + address[STREET][1] + ')')
if HOUSE_NUMBER_STRING[current_address_index] == '':
test_passed = 1
elif address[HOUSE_NUMBER][1] == HOUSE_NUMBER_STRING[current_address_index]:
- print 'House number\t-> ok (' + address[HOUSE_NUMBER][1] + ')'
+ print ('House number\t-> ok (' + address[HOUSE_NUMBER][1] + ')')
test_passed = 1
if guidable == 1:
if test_passed == 1:
- print 'TEST PASSED'
+ print ('TEST PASSED')
else:
- print 'TEST FAILED (wrong address)'
+ print ('TEST FAILED (wrong address)')
loop.quit()
else:
- print 'TEST FAILED (non-guidable address)'
+ print ('TEST FAILED (non-guidable address)')
loop.quit()
address_index = current_address_index + 1
if address_index < len(COUNTRY_STRING):
startSearch(address_index)
else:
- print 'END OF THE TEST'
+ print('END OF THE TEST')
loop.quit()
@@ -333,7 +333,7 @@ def content_updated_handler(handle, guidable, available_selection_criteria, addr
elif search_mode == 1:
full_string_search(handle, target_search_string)
else:
- print '\nTEST FAILED (Invalid search mode)'
+ print ('\nTEST FAILED (Invalid search mode)')
loop.quit()
# Handler for SpellResult callback
@@ -355,7 +355,7 @@ def spell_result_handler(handle, unique_string, valid_characters, full_match):
if len(valid_characters) == 1:
if unicode(valid_characters[0]) == u'\x08':
- print '\nTEST FAILED (Dead end spelling)'
+ print ('\nTEST FAILED (Dead end spelling)')
loop.quit()
if unicode(entered_search_string) == unicode(target_search_string):
@@ -399,7 +399,7 @@ def search_result_list_handler(handle, total_size, window_offset, window_size, r
'\' (Session '+str(int(session_handle)) + ' LocationInputHandle ' + str(int(handle))+')')
location_input_interface.selectEntry(dbus.UInt32(session_handle), dbus.UInt32(handle), dbus.UInt16(0))
else:
- print '\nTEST FAILED (Unexpected single result list)'
+ print ('\nTEST FAILED (Unexpected single result list)')
loop.quit()
elif spell_next_character == 1:
spell_next_character = 0
@@ -426,8 +426,8 @@ bus.add_signal_receiver(content_updated_handler,
# Timeout
def timeout():
- print 'Timeout Expired'
- print '\nTEST FAILED\n'
+ print('Timeout Expired')
+ print ('\nTEST FAILED\n')
loop.quit()
def startSearch(address_index):
@@ -452,21 +452,21 @@ def startSearch(address_index):
full_string_search(location_input_handle, target_search_string)
-session = bus.get_object('org.genivi.navigationcore.Session', '/org/genivi/navigationcore')
-session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigationcore.Session')
+session = bus.get_object('org.genivi.navigation.navigationcore.Session_Session', '/Session')
+session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.navigationcore.Session')
# Get SessionHandle
-session_handle = session_interface.CreateSession(dbus.String('test location input'))
-print 'Session handle = ' + str(session_handle)
+session_handle = session_interface.createSession(dbus.String('test location input'))
+print ('Session handle = ' + str(session_handle))
location_input_obj = bus.get_object('org.genivi.navigation.navigationcore.LocationInput_LocationInput', '/LocationInput')
location_input_interface = dbus.Interface(location_input_obj, dbus_interface='org.genivi.navigation.navigationcore.LocationInput')
# Get LocationInputHandle
location_input_handle = location_input_interface.createLocationInput(dbus.UInt32(session_handle))
-print 'LocationInput handle = ' + str(location_input_handle)
+print ('LocationInput handle = ' + str(location_input_handle))
attributes = location_input_interface.getSupportedAddressAttributes()
-print 'Initially supported address attributes = ' + selection_criteria_array_to_string(attributes)
+print ('Initially supported address attributes = ' + selection_criteria_array_to_string(attributes))
# Configuration
current_address_index = 0
diff --git a/test/navigation/test-route-calculation-capi.py b/test/navigation/test-route-calculation-capi.py
new file mode 100755
index 0000000..c05b1d8
--- /dev/null
+++ b/test/navigation/test-route-calculation-capi.py
@@ -0,0 +1,214 @@
+#!/usr/bin/python
+
+"""
+**************************************************************************
+* @licence app begin@
+* SPDX-License-Identifier: MPL-2.0
+*
+* \copyright Copyright (C) 2014, XS Embedded GmbH, PCA Peugeot Citroen
+*
+* \file simulation-dashboard.py
+*
+* \brief This simple test shows how the route calculation
+* could be easily tested using a python script
+*
+* \author Marco Residori <marco.residori@xse.de>
+* \author Philippe Colliot <philippe.colliot@mpsa.com>
+*
+* \version 1.1
+*
+* This Source Code Form is subject to the terms of the
+* Mozilla Public License, 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/.
+* List of changes:
+* 04-02-2016, Philippe Colliot, Update to the new API ('i' for enumerations and 'yv' for variants)
+*
+* @licence end@
+**************************************************************************
+"""
+
+import dbus
+import gobject
+import dbus.mainloop.glib
+from collections import namedtuple,defaultdict
+from _dbus_bindings import Int32
+from PIL.GimpGradientFile import SEGMENTS
+from xml.dom.minidom import parse
+import xml.dom.minidom
+import argparse
+import sys
+import errno
+
+#import pdb;pdb.set_trace()
+
+from pip import locations
+
+#constants as defined in the Navigation API
+GENIVI_NAVIGATIONCORE_LATITUDE = 0x00a0
+GENIVI_NAVIGATIONCORE_LONGITUDE = 0x00a1
+GENIVI_NAVIGATIONCORE_TOTAL_TIME = 0x018e
+GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE = 0x018f
+GENIVI_NAVIGATIONCORE_ROAD_NAME = 0x0147
+GENIVI_NAVIGATIONCORE_START_LATITUDE = 0x0141
+GENIVI_NAVIGATIONCORE_END_LATITUDE = 0x0142
+GENIVI_NAVIGATIONCORE_START_LONGITUDE = 0x0143
+GENIVI_NAVIGATIONCORE_END_LONGITUDE = 0x0144
+GENIVI_NAVIGATIONCORE_DISTANCE = 0x0148
+GENIVI_NAVIGATIONCORE_TIME = 0x0149
+GENIVI_NAVIGATIONCORE_SPEED = 0x00a4
+
+#constants used into the script
+TIME_OUT = 10000
+
+print('--------------------------')
+print('Route Calculation Test')
+print('--------------------------')
+
+parser = argparse.ArgumentParser(description='Route Calculation Test for navigation PoC and FSA.')
+parser.add_argument('-r','--rou',action='store', dest='routes', help='List of routes in xml format')
+args = parser.parse_args()
+
+if args.routes == None:
+ print('route file is missing')
+ sys.exit(1)
+else:
+ try:
+ DOMTree = xml.dom.minidom.parse(args.routes)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ print('file not exists')
+ sys.exit(1)
+ route_set = DOMTree.documentElement
+
+print("Country : %s" % route_set.getAttribute("country"))
+
+routes = route_set.getElementsByTagName("route")
+
+#create dictionary with the locations
+locations = {}
+for location in route_set.getElementsByTagName("location"):
+ lat_long = [location.getElementsByTagName("latitude")[0].childNodes[0].data,location.getElementsByTagName("longitude")[0].childNodes[0].data]
+ locations[location.getAttribute("name")] = lat_long
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+#connect to session bus
+bus = dbus.SessionBus()
+
+#add signal receivers
+def catchall_route_calculation_signals_handler(routeHandle, status, percentage):
+ print 'Route Calculation: ' + str(int(percentage)) + ' %'
+ if int(percentage) == 100:
+ #get route overview
+ overview = g_routing_interface.GetRouteOverview(dbus.UInt32(g_route_handle),dbus.Array([dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE),dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME)]))
+ #retrieve distance
+ totalDistance = dbus.Struct(overview[dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE)])
+ print 'Total Distance: ' + str(totalDistance[1]/1000) + ' km'
+ totalTime = dbus.Struct(overview[dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME)])
+ m, s = divmod(totalTime[1], 60)
+ h, m = divmod(m, 60)
+ print "Total Time: %d:%02d:%02d" % (h, m, s)
+ #get route segments GetRouteSegments(const uint32_t& routeHandle, const int16_t& detailLevel, const std::vector< DBusCommonAPIEnumeration >& valuesToReturn, const uint32_t& numberOfSegments, const uint32_t& offset, uint32_t& totalNumberOfSegments, std::vector< std::map< DBusCommonAPIEnumeration, DBusCommonAPIVariant > >& routeSegments)
+ valuesToReturn = [dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_ROAD_NAME),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_START_LATITUDE),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_END_LATITUDE),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_START_LONGITUDE),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_END_LONGITUDE),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_DISTANCE),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_TIME),
+ dbus.Int32(GENIVI_NAVIGATIONCORE_SPEED)]
+ ret = g_routing_interface.GetRouteSegments(dbus.UInt32(g_route_handle),dbus.Int16(0),dbus.Array(valuesToReturn),dbus.UInt32(500),dbus.UInt32(0))
+ print "Total number of segments: " + str(ret[0])
+ #len(ret[1]) is size
+ #ret[1][0][GENIVI_NAVIGATIONCORE_START_LATITUDE] is the start latitude
+# pdb.set_trace()
+ route = g_current_route + 1
+ if route < routes.length:
+ launch_route_calculation(route)
+ else:
+ for i in range(routes.length):
+ g_routing_interface.DeleteRoute(dbus.UInt32(g_session_handle),dbus.UInt32(routes[i].getElementsByTagName("handle")[0].childNodes[0].data))
+ g_session_interface.DeleteSession(dbus.UInt32(g_session_handle))
+
+def catchall_session_signals_handler(sessionHandle):
+ print('Session handle deleted: '+str(sessionHandle))
+ if sessionHandle == g_session_handle:
+ print 'Test PASSED'
+ else:
+ print 'Test FAILED'
+ loop.quit()
+
+def catchall_route_deleted_signals_handler(routeHandle):
+ print('Route handle deleted: '+str(routeHandle))
+
+bus.add_signal_receiver(catchall_route_calculation_signals_handler, \
+ dbus_interface = "org.genivi.navigationcore.Routing", \
+ signal_name = "RouteCalculationProgressUpdate")
+
+bus.add_signal_receiver(catchall_route_deleted_signals_handler, \
+ dbus_interface = "org.genivi.navigationcore.Routing", \
+ signal_name = "RouteDeleted")
+
+bus.add_signal_receiver(catchall_session_signals_handler, \
+ dbus_interface = "org.genivi.navigationcore.Session", \
+ signal_name = "SessionDeleted")
+
+#timeout
+def timeout():
+ print 'Timeout Expired'
+ print '\nTest FAILED'
+ loop.quit()
+
+def launch_route_calculation(route):
+ global g_current_route
+ global g_route_handle
+ global g_routing_interface
+ global g_session_handle
+ g_current_route = route
+ print 'Route name: '+routes[g_current_route].getElementsByTagName("name")[0].childNodes[0].data
+ #get route handle
+ g_route_handle = g_routing_interface.CreateRoute(dbus.UInt32(g_session_handle))
+ routes[g_current_route].getElementsByTagName("handle")[0].childNodes[0].data = g_route_handle
+ print 'Route handle: ' + str(g_route_handle)
+ start = routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data
+ dest = routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data
+ print 'Calculating route from \
+'+start+'(' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1]) + ') to \
+'+dest+'(' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1]) + ')'
+ #set waypoints
+ g_routing_interface.SetWaypoints(dbus.UInt32(g_session_handle), \
+ dbus.UInt32(g_route_handle), \
+ dbus.Boolean(0), \
+ dbus.Array([ \
+ dbus.Dictionary({dbus.UInt16(GENIVI_NAVIGATIONCORE_LATITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0])]),dbus.UInt16(GENIVI_NAVIGATIONCORE_LONGITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1])])}), \
+ dbus.Dictionary({dbus.UInt16(GENIVI_NAVIGATIONCORE_LATITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0])]),dbus.UInt16(GENIVI_NAVIGATIONCORE_LONGITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1])])}) \
+ ]) \
+ )
+
+ #calculate route
+ g_routing_interface.CalculateRoute(dbus.UInt32(g_session_handle),dbus.UInt32(g_route_handle))
+
+
+session = bus.get_object('org.genivi.navigationcore.Session','/org/genivi/navigationcore')
+g_session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigationcore.Session')
+
+#get session handle
+g_session_handle = g_session_interface.CreateSession(dbus.String("test route calculation"))
+print 'Session handle: ' + str(g_session_handle)
+
+routing_obj = bus.get_object('org.genivi.navigationcore.Routing','/org/genivi/navigationcore')
+g_routing_interface = dbus.Interface(routing_obj, dbus_interface='org.genivi.navigationcore.Routing')
+
+g_current_route = 0
+launch_route_calculation(0)
+
+
+#main loop
+gobject.timeout_add(TIME_OUT, timeout)
+loop = gobject.MainLoop()
+loop.run()
+
+
diff --git a/test/poi-service/poi-manager-client/README.md b/test/poi-service/poi-manager-client/README.md
index ff729dc..7380743 100644
--- a/test/poi-service/poi-manager-client/README.md
+++ b/test/poi-service/poi-manager-client/README.md
@@ -28,6 +28,10 @@ or to build updated parts
## How To Run
+CommonAPI requires two configuration files that have to be accessible by the PATH, e.g.
+```cp ./commonapi4dbus.ini ~/```
+```cp ./commonapi-dbus.ini ~/```
+
```./run.sh```
## How to test
diff --git a/test/poi-service/poi-manager-client/commonapi-dbus.ini b/test/poi-service/poi-manager-client/commonapi-dbus.ini
new file mode 100644
index 0000000..2c56b8e
--- /dev/null
+++ b/test/poi-service/poi-manager-client/commonapi-dbus.ini
@@ -0,0 +1,5 @@
+[local:org.genivi.navigation.poiservice.POIContentAccessModule:POIContentAccessModuleService]
+service=org.genivi.navigation.poiservice
+path=/org/genivi/navigation/poiservice/POIContentAccessModule
+interface=org.genivi.navigation.poiservice.POIContentAccessModule
+
diff --git a/test/poi-service/poi-manager-client/commonapi4dbus.ini b/test/poi-service/poi-manager-client/commonapi4dbus.ini
new file mode 100644
index 0000000..1e5b30b
--- /dev/null
+++ b/test/poi-service/poi-manager-client/commonapi4dbus.ini
@@ -0,0 +1,4 @@
+[default]
+binding=dbus
+
+