diff options
author | <philippe colliot> | 2016-01-15 09:48:17 +0100 |
---|---|---|
committer | <philippe colliot> | 2016-01-15 09:48:17 +0100 |
commit | 9be8508170ae34680ab8107f04a6398db373ecc2 (patch) | |
tree | 70e45b11d9be7e1edb8baa1d327a89b605c289cf /src | |
parent | 8226583ad533da922ae41eafcf184cb3ee362640 (diff) | |
download | poi-service-9be8508170ae34680ab8107f04a6398db373ecc2.tar.gz |
Some improvements of scripts and README
Diffstat (limited to 'src')
7 files changed, 378 insertions, 14 deletions
diff --git a/src/navigation/CMakeLists.txt b/src/navigation/CMakeLists.txt index 445dd32..4ebd592 100644 --- a/src/navigation/CMakeLists.txt +++ b/src/navigation/CMakeLists.txt @@ -27,6 +27,8 @@ option(WITH_DEBUG "Enable the debug messages" OFF) option(WITH_SPEECH "Enable the voice messages" OFF) +option(WITH_PLUGIN_MIGRATION + "Enable navit plugin migration to commonapi" OFF) option(YOCTO_CONFIG "Build using Yocto" OFF) option(NAVIT_DISABLE_QT @@ -42,6 +44,7 @@ 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}") +message(STATUS "WITH_PLUGIN_MIGRATION = ${WITH_PLUGIN_MIGRATION}") message(STATUS "YOCTO_CONFIG = ${YOCTO_CONFIG}") message(STATUS "NAVIT_DISABLE_QT = ${NAVIT_DISABLE_QT}") message(STATUS "NAVIT_SAMPLE_MAP = ${NAVIT_SAMPLE_MAP}") diff --git a/src/navigation/navigation-core/CMakeLists.txt b/src/navigation/navigation-core/CMakeLists.txt index f7119a4..6278c71 100644 --- a/src/navigation/navigation-core/CMakeLists.txt +++ b/src/navigation/navigation-core/CMakeLists.txt @@ -87,4 +87,8 @@ add_subdirectory(session-plugin) add_subdirectory(enhancedposition-plugin) +if (WITH_PLUGIN_MIGRATION) + set(FRANCA_DIR "${API_DIR}/franca") + add_subdirectory(configuration-server-plugin) +endif() diff --git a/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt new file mode 100644 index 0000000..b93497d --- /dev/null +++ b/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt @@ -0,0 +1,82 @@ +########################################################################### +# @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(configuration-server-plugin) +message(STATUS ${PROJECT_NAME}) + +set(CMAKE_VERBOSE_MAKEFILE on) +set(CMAKE_CXX_FLAGS "-Wall -std=c++0x") + +set(PARENT_API navigationcore) +set(ROOT_API navigation) +set(API_VERSION_MAJOR 0) +set(API_VERSION_MINOR 1) +set(API_VERSION "v${API_VERSION_MAJOR}_${API_VERSION_MINOR}") +set(COMMONAPI_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/src-gen") +set(PRJ_SRC_GEN_PATH ${COMMONAPI_GEN_DIR}/${API_VERSION}/org/genivi/${ROOT_API}/${PARENT_API}) +set(PRJ_SRC_GEN_NAVIGATION_TYPES_PATH ${COMMONAPI_GEN_DIR}/org/genivi/${ROOT_API}) + +# Packages +find_package(PkgConfig REQUIRED) +find_package(CommonAPI 3.1.2 REQUIRED) +find_package(CommonAPI-DBus 3.1.2 REQUIRED) + +pkg_check_modules(DBUS "dbus-1 >= 1.4") +pkg_check_modules(COMMONAPI "CommonAPI >= 3.1") +pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1") +pkg_check_modules(GOBJECT gobject-2.0) +pkg_check_modules(GLIB REQUIRED glib-2.0) + +# Source Files +FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) + +add_subdirectory(${FRANCA_DIR}/navigation/navigationcore "${CMAKE_CURRENT_BINARY_DIR}/franca") + +FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp) +FILE(GLOB PRJ_STUB_GEN_TYPES ${PRJ_SRC_GEN_NAVIGATION_TYPES_PATH}/*Types*.cpp) +set(PRJ_SRCS ${PRJ_LOCAL_SRCS} ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_GEN_TYPES}) + +include_directories( + ${PRJ_SRC_GEN_PATH} + ${DBUS_INCLUDE_DIRS} + ${COMMONAPI_GEN_DIR} + ${COMMONAPI_INCLUDE_DIRS} + ${COMMONAPI_DBUS_INCLUDE_DIRS} + ${GOBJECT_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} +) + +link_directories( + ${DBUS_LIBDIR} + ${COMMONAPI_LIBDIR} + ${COMMONAPI_DBUS_LIBDIR} + ${GOBJECT_LIBRARY_DIRS} + ${GLIB_LIBRARY_DIRS} +) + +set(LIBRARIES + ${DBUS_LIBRARIES} + ${COMMONAPI_LIBRARIES} + ${COMMONAPI_DBUS_LIBRARIES} + ${GOBJECT_LIBRARIES} + ${GLIB_LIBRARIES} +) + +# Build service +add_executable(${PROJECT_NAME} ${PRJ_SRCS}) +target_link_libraries(${PROJECT_NAME} ${LIBRARIES}) + diff --git a/src/navigation/navigation-core/configuration-server-plugin/configuration-server-plugin-stub.cpp b/src/navigation/navigation-core/configuration-server-plugin/configuration-server-plugin-stub.cpp new file mode 100644 index 0000000..d9e15be --- /dev/null +++ b/src/navigation/navigation-core/configuration-server-plugin/configuration-server-plugin-stub.cpp @@ -0,0 +1,103 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2015, PCA Peugeot Citroen +* +* \file configuration-server-plugin-stub.cpp +* +* \brief This file is part of the poi proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* 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 "configuration-server-plugin-stub.h" + +NavigationCoreConfigurationServerStub::NavigationCoreConfigurationServerStub() +{ + +} + +NavigationCoreConfigurationServerStub::~NavigationCoreConfigurationServerStub() +{ + +} + +void NavigationCoreConfigurationServerStub::getVersion(const std::shared_ptr<CommonAPI::ClientId> _client, getVersionReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::setLocale(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _languageCode, std::string _countryCode, std::string _scriptCode, setLocaleReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getLocale(const std::shared_ptr<CommonAPI::ClientId> _client, getLocaleReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getSupportedLocales(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedLocalesReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::setTimeFormat(const std::shared_ptr<CommonAPI::ClientId> _client, ::org::genivi::navigation::NavigationTypes::TimeFormat _format, setTimeFormatReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getTimeFormat(const std::shared_ptr<CommonAPI::ClientId> _client, getTimeFormatReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getSupportedTimeFormats(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedTimeFormatsReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::setCoordinatesFormat(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationCoreConfiguration::CoordinatesFormat _coordinatesFormat, setCoordinatesFormatReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getCoordinatesFormat(const std::shared_ptr<CommonAPI::ClientId> _client, getCoordinatesFormatReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getSupportedCoordinatesFormat(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedCoordinatesFormatReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::setUnitsOfMeasurement(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationCoreConfiguration::UnitsOfMeasurement _unitsOfMeasurementList, setUnitsOfMeasurementReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getUnitsOfMeasurement(const std::shared_ptr<CommonAPI::ClientId> _client, getUnitsOfMeasurementReply_t _reply) +{ + +} + +void NavigationCoreConfigurationServerStub::getSupportedUnitsOfMeasurement(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedUnitsOfMeasurementReply_t _reply) +{ + +} + diff --git a/src/navigation/navigation-core/configuration-server-plugin/configuration-server-plugin-stub.h b/src/navigation/navigation-core/configuration-server-plugin/configuration-server-plugin-stub.h new file mode 100644 index 0000000..383e658 --- /dev/null +++ b/src/navigation/navigation-core/configuration-server-plugin/configuration-server-plugin-stub.h @@ -0,0 +1,66 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2015, PCA Peugeot Citroen +* +* \file configuration-server-plugin.h +* +* \brief This file is part of the poi proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* 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@ +*/ +#ifndef CONFIGURATIONSERVERSTUBIMPL_H_ +#define CONFIGURATIONSERVERSTUBIMPL_H_ + +#include <CommonAPI/CommonAPI.hpp> + +#include <org/genivi/CommonTypes.hpp> +#include <org/genivi/navigation/NavigationTypes.hpp> +#include <org/genivi/navigation/navigationcore/NavigationCoreTypes.hpp> +#include <v0_1/org/genivi/navigation/navigationcore/NavigationCoreConfigurationStubDefault.hpp> + +using namespace std; +using namespace v0_1::org::genivi::navigation::navigationcore; +using namespace org::genivi::navigation; +using namespace org::genivi; + + +class NavigationCoreConfigurationServerStub: public NavigationCoreConfigurationStubDefault { + +public: + NavigationCoreConfigurationServerStub(); + ~NavigationCoreConfigurationServerStub(); + void getVersion(const std::shared_ptr<CommonAPI::ClientId> _client, getVersionReply_t _reply); + void setLocale(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _languageCode, std::string _countryCode, std::string _scriptCode, setLocaleReply_t _reply); + void getLocale(const std::shared_ptr<CommonAPI::ClientId> _client, getLocaleReply_t _reply); + void getSupportedLocales(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedLocalesReply_t _reply); + void setTimeFormat(const std::shared_ptr<CommonAPI::ClientId> _client, ::org::genivi::navigation::NavigationTypes::TimeFormat _format, setTimeFormatReply_t _reply); + void getTimeFormat(const std::shared_ptr<CommonAPI::ClientId> _client, getTimeFormatReply_t _reply); + void getSupportedTimeFormats(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedTimeFormatsReply_t _reply); + void setCoordinatesFormat(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationCoreConfiguration::CoordinatesFormat _coordinatesFormat, setCoordinatesFormatReply_t _reply); + void getCoordinatesFormat(const std::shared_ptr<CommonAPI::ClientId> _client, getCoordinatesFormatReply_t _reply); + void getSupportedCoordinatesFormat(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedCoordinatesFormatReply_t _reply); + void setUnitsOfMeasurement(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationCoreConfiguration::UnitsOfMeasurement _unitsOfMeasurementList, setUnitsOfMeasurementReply_t _reply); + void getUnitsOfMeasurement(const std::shared_ptr<CommonAPI::ClientId> _client, getUnitsOfMeasurementReply_t _reply); + void getSupportedUnitsOfMeasurement(const std::shared_ptr<CommonAPI::ClientId> _client, getSupportedUnitsOfMeasurementReply_t _reply); + +private: + +}; + +#endif /* CONFIGURATIONSERVERSTUBIMPL_H_ */ diff --git a/src/navigation/navigation-core/configuration-server-plugin/main.cpp b/src/navigation/navigation-core/configuration-server-plugin/main.cpp new file mode 100644 index 0000000..1755085 --- /dev/null +++ b/src/navigation/navigation-core/configuration-server-plugin/main.cpp @@ -0,0 +1,77 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2015, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the poi proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* 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 <stdbool.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <sys/types.h> +#include <iostream> +#include <fstream> +#include <cmath> +#include <thread> +#include <typeinfo> +#include <glib.h> + +#include <CommonAPI/CommonAPI.hpp> //Defined in the Common API Runtime library +#include "configuration-server-plugin-stub.h" + +int main(int argc , char** argv ) +{ + // Set the global C and C++ locale to the user-configured locale, + // so we can use std::cout with UTF-8, via Glib::ustring, without exceptions. + std::locale::global(std::locale("")); + + // Common API data init + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + + const std::string &domain = "local"; + const std::string &instance = "Configuration"; + + std::string connection = "Configuration"; + + std::shared_ptr<NavigationCoreConfigurationServerStub> myServiceConfiguration = std::make_shared<NavigationCoreConfigurationServerStub>(); + + bool successfullyRegistered = runtime->registerService(domain, instance, myServiceConfiguration, connection); + while (!successfullyRegistered) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + successfullyRegistered = runtime->registerService(domain, instance, myServiceConfiguration, connection); + } + + GMainLoop * mainloop ; + + // Create a new GMainLoop with default context and initial state of "not running " + mainloop = g_main_loop_new (g_main_context_default() , FALSE ); + + // Send a feedback to the user + cout << "configuration server started" << endl; + + g_main_loop_run ( mainloop ); + + return EXIT_SUCCESS; +} + diff --git a/src/poi-service/rebuild_all.sh b/src/poi-service/rebuild_all.sh index 2ef165a..677fc3d 100755 --- a/src/poi-service/rebuild_all.sh +++ b/src/poi-service/rebuild_all.sh @@ -1,17 +1,46 @@ #!/bin/bash -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 +debug="OFF" +franca="OFF" +dbus="ON" +commonapi_tools_option="" + +while getopts df opt +do + case $opt in + d) + debug="ON" + ;; + f) + franca="ON" + dbus="OFF" + ;; + \?) + echo "Usage:" + echo "$0 [-df]" + echo "-d: Enable the debug messages" + echo "-f: Build using the Franca interfaces" + exit 1 + esac +done +set -e + +if [ $franca="ON" ] +then + 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 + commonapi_tools_option="-DCOMMONAPI_DBUS_TOOL_DIR="$COMMONAPI_DBUS_TOOL_DIR" -DCOMMONAPI_TOOL_DIR="$COMMONAPI_TOOL_DIR fi echo 'delete the build folder' @@ -20,8 +49,8 @@ rm -rf build mkdir build cd build -echo 'build with CommonAPI' -cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DWITH_DBUS_INTERFACE=OFF -DCOMMONAPI_DBUS_TOOL_DIR=$COMMONAPI_DBUS_TOOL_DIR -DCOMMONAPI_TOOL_DIR=$COMMONAPI_TOOL_DIR -DWITH_DEBUG=ON . ../ +echo 'build poi-server' +cmake -DWITH_FRANCA_DBUS_INTERFACE=$franca -DWITH_DBUS_INTERFACE=$dbus $commonapi_tools_option -DWITH_DEBUG=$debug ../ make |