summaryrefslogtreecommitdiff
path: root/src
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 /src
parent85ea9e487e096e8c0ffc8f3469c9aaad27e2a7cd (diff)
downloadpoi-service-6412262adc39b2db08ca27d0030c7103cb23a5fb.tar.gz
some updates of Franca files
Diffstat (limited to 'src')
-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
8 files changed, 622 insertions, 9 deletions
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