From ec98b346ff5570c52fdd609c154271e4df93e24a Mon Sep 17 00:00:00 2001 From: Date: Thu, 3 Dec 2015 17:36:14 +0100 Subject: Update of poi service with the new fidl --- api/franca/CMakeLists.txt | 30 +++++++++++++--------- api/franca/navigation/poiservice/CMakeLists.txt | 29 ++++++++++++--------- src/poi-service/CMakeLists.txt | 2 +- src/poi-service/README | 4 +-- src/poi-service/poi-manager-server/CMakeLists.txt | 2 +- .../poi-manager-server/poi-manager-server-stub.cpp | 8 +++--- .../poi-manager-server/poi-manager-server-stub.h | 8 +++--- src/poi-service/rebuild_all.sh | 18 ++++++++----- test/poi-service/CMakeLists.txt | 2 +- test/poi-service/README | 5 ++-- test/poi-service/poi-manager-client/CMakeLists.txt | 2 +- test/poi-service/poi-manager-client/main.cpp | 18 ++++++------- test/poi-service/rebuild_all.sh | 18 ++++++++----- 13 files changed, 83 insertions(+), 63 deletions(-) diff --git a/api/franca/CMakeLists.txt b/api/franca/CMakeLists.txt index 421fa8e..6efc9ef 100644 --- a/api/franca/CMakeLists.txt +++ b/api/franca/CMakeLists.txt @@ -4,9 +4,9 @@ # # Component Name: whole franca generation # -# Author: Marco Residori +# Author: Philippe Colliot # -# Copyright (C) 2015, XS Embedded GmbH +# Copyright (C) 2015, PCA Peugeot Citroen # # Note: # The current file is an adaptation of the example file @@ -24,10 +24,16 @@ cmake_minimum_required (VERSION 2.8.1) project(whole-franca) -option(COMMONAPI_TOOL_GENERATOR - "Absolute path to CommonAPI code generator" "") -option(COMMONAPI_DBUS_TOOL_GENERATOR - "Absolute path to CommonAPI-DBus code generator" "") +option(COMMONAPI_TOOL_DIR + "Absolute path to CommonAPI tool" "") +option(COMMONAPI_DBUS_TOOL_DIR + "Absolute path to CommonAPI-DBus tool" "") + +execute_process(COMMAND uname -i OUTPUT_VARIABLE OS_VERSION) +if("${OS_VERSION}" MATCHES "i686") + set(OS_VERSION "x86") +endif() +message(STATUS "OS_VERSION = ${OS_VERSION}") set(COMMONAPI_FIDL_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(COMMONAPI_FIDL_DIR_NAVIGATION "${COMMONAPI_FIDL_DIR}/navigation") @@ -50,17 +56,17 @@ ${COMMONAPI_FIDL_DIR_HMI}/*.fidl ${COMMONAPI_FIDL_DIR_HMI}/speechservice/*.fidl ) -if (COMMONAPI_TOOL_GENERATOR) +if (COMMONAPI_TOOL_DIR) execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} - COMMAND ${COMMONAPI_DBUS_TOOL_GENERATOR} -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) + COMMAND ${COMMONAPI_TOOL_DIR}/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/${OS_VERSION}/commonapi-generator-linux-${OS_VERSION} -sk -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) else () - message (FATAL_ERROR "Set the variable -DCOMMONAPI_TOOL_GENERATOR=") + message (FATAL_ERROR "Set the variable -DCOMMONAPI_TOOL_DIR=") endif () -if (COMMONAPI_DBUS_TOOL_GENERATOR) +if (COMMONAPI_DBUS_TOOL_DIR) execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} - COMMAND ${COMMONAPI_TOOL_GENERATOR} -sk -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) + COMMAND ${COMMONAPI_DBUS_TOOL_DIR}/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/${OS_VERSION}/commonapi-dbus-generator-linux-${OS_VERSION} -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) else () - message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_GENERATOR=") + message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_DIR=") endif () diff --git a/api/franca/navigation/poiservice/CMakeLists.txt b/api/franca/navigation/poiservice/CMakeLists.txt index 042441a..f057935 100644 --- a/api/franca/navigation/poiservice/CMakeLists.txt +++ b/api/franca/navigation/poiservice/CMakeLists.txt @@ -22,12 +22,18 @@ cmake_minimum_required (VERSION 2.8.1) -project(poi-manager-server) +project(franca-poiservice) -option(COMMONAPI_TOOL_GENERATOR - "Absolute path to CommonAPI code generator" "") -option(COMMONAPI_DBUS_TOOL_GENERATOR - "Absolute path to CommonAPI-DBus code generator" "") +option(COMMONAPI_TOOL_DIR + "Absolute path to CommonAPI tool" "") +option(COMMONAPI_DBUS_TOOL_DIR + "Absolute path to CommonAPI-DBus tool" "") + +execute_process(COMMAND uname -i OUTPUT_VARIABLE OS_VERSION) +if("${OS_VERSION}" MATCHES "i686") + set(OS_VERSION "x86") +endif() +message(STATUS "OS_VERSION = ${OS_VERSION}") set(COMMONAPI_FIDL_DIR "${CMAKE_CURRENT_SOURCE_DIR}") @@ -37,19 +43,18 @@ include(FindPkgConfig) # generate code from fidl file(GLOB FIDL_FILES "${COMMONAPI_FIDL_DIR}/*.fidl") -message("FIDL_FILES: ${FIDL_FILES}") -if (COMMONAPI_TOOL_GENERATOR) +if (COMMONAPI_TOOL_DIR) execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} - COMMAND ${COMMONAPI_DBUS_TOOL_GENERATOR} -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) + COMMAND ${COMMONAPI_TOOL_DIR}/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/${OS_VERSION}/commonapi-generator-linux-${OS_VERSION} -sk -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) else () - message (FATAL_ERROR "Set the variable -DCOMMONAPI_TOOL_GENERATOR=") + message (FATAL_ERROR "Set the variable -DCOMMONAPI_TOOL_DIR=") endif () -if (COMMONAPI_DBUS_TOOL_GENERATOR) +if (COMMONAPI_DBUS_TOOL_DIR) execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} - COMMAND ${COMMONAPI_TOOL_GENERATOR} -sk -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) + COMMAND ${COMMONAPI_DBUS_TOOL_DIR}/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/${OS_VERSION}/commonapi-dbus-generator-linux-${OS_VERSION} -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) else () - message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_GENERATOR=") + message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_DIR=") endif () diff --git a/src/poi-service/CMakeLists.txt b/src/poi-service/CMakeLists.txt index dcb7f2b..300cfae 100644 --- a/src/poi-service/CMakeLists.txt +++ b/src/poi-service/CMakeLists.txt @@ -47,6 +47,6 @@ add_subdirectory(${API_DIR}/poi-service "${DBUS_GENERATED_INCLUDE_DIR}/poi-servi add_subdirectory(poi-server) if (WITH_FRANCA_DBUS_INTERFACE) - set(FRANCA_DIR "${API_DIR}/franca/navigation") + set(FRANCA_DIR "${API_DIR}/franca") add_subdirectory(poi-manager-server) endif() diff --git a/src/poi-service/README b/src/poi-service/README index ca219cf..5c64dcd 100644 --- a/src/poi-service/README +++ b/src/poi-service/README @@ -59,10 +59,8 @@ NB: You need CommonAPI 3.1.2 and Franca 0.9.1 installed You need to pass as parameter to the cmake the link to your patched dbus library (required by CommonAPI) -NB: For the 64 bits version, replace 'x86' with 'x86_64' in the command below: - cd build -cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DDBUS_LIB_PATH=yourPath -DCOMMONAPI_DBUS_TOOL_GENERATOR=/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/x86/commonapi-dbus-generator-linux-x86 -DCOMMONAPI_TOOL_GENERATOR=/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86 -DWITH_DEBUG=ON ../ +cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DDBUS_LIB_PATH=yourPath -DCOMMONAPI_DBUS_TOOL_DIR= -DCOMMONAPI_TOOL_DIR= -DWITH_DEBUG=ON ../ make cd .. diff --git a/src/poi-service/poi-manager-server/CMakeLists.txt b/src/poi-service/poi-manager-server/CMakeLists.txt index 75cbca7..56fbe8a 100644 --- a/src/poi-service/poi-manager-server/CMakeLists.txt +++ b/src/poi-service/poi-manager-server/CMakeLists.txt @@ -47,7 +47,7 @@ pkg_check_modules(GLIB REQUIRED glib-2.0) FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) FILE(GLOB PRJ_COMMON_SRCS ${COMMON_DIR}/poi-common-database.cpp ${COMMON_DIR}/poi-common-math.cpp) -add_subdirectory(${FRANCA_DIR}/poiservice "${CMAKE_CURRENT_BINARY_DIR}/franca") +add_subdirectory(${FRANCA_DIR}/navigation/poiservice "${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 ${PRJ_SRC_GEN_POISERVICE_TYPES_PATH}/*Types*.cpp) diff --git a/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp b/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp index 2832278..a4345db 100644 --- a/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp +++ b/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp @@ -1234,7 +1234,7 @@ PoiManagerServerStub::~PoiManagerServerStub() { void PoiManagerServerStub::getVersion(const std::shared_ptr _client, getVersionReply_t _reply) { - NavigationTypes::Version POIContentManagerVersion(m_version); + CommonTypes::Version POIContentManagerVersion(m_version); _reply(POIContentManagerVersion); } @@ -1259,9 +1259,9 @@ void PoiManagerServerStub::getLocale(const std::shared_ptr void PoiManagerServerStub::getSupportedLocales(const std::shared_ptr _client, getSupportedLocalesReply_t _reply) { - std::vector< NavigationTypes::Locales> localeList; - NavigationTypes::Locales en_US { "eng","USA", "Latn" }; - NavigationTypes::Locales fr_FR { "fra","FRA", "Latn" }; + std::vector< NavigationTypes::Locale> localeList; + NavigationTypes::Locale en_US { "eng","USA", "Latn" }; + NavigationTypes::Locale fr_FR { "fra","FRA", "Latn" }; localeList.push_back(en_US); localeList.push_back(fr_FR); diff --git a/src/poi-service/poi-manager-server/poi-manager-server-stub.h b/src/poi-service/poi-manager-server/poi-manager-server-stub.h index db49660..0435bc7 100644 --- a/src/poi-service/poi-manager-server/poi-manager-server-stub.h +++ b/src/poi-service/poi-manager-server/poi-manager-server-stub.h @@ -29,9 +29,10 @@ #include +#include #include #include -#include +#include #include "poi-common-database.h" @@ -42,6 +43,7 @@ using namespace std; using namespace v0_1::org::genivi::navigation::poiservice; using namespace org::genivi::navigation; +using namespace org::genivi; class sqlRequest { @@ -184,7 +186,7 @@ private: }; -class PoiManagerServerStub: public POIContentManagerStubDefault { +class PoiManagerServerStub: public POIContentAccessModuleStubDefault { public: PoiManagerServerStub(); @@ -212,7 +214,7 @@ public: private: - NavigationTypes::Version m_version; + CommonTypes::Version m_version; std::string m_languageCode, m_countryCode, m_scriptCode; uint16_t m_availableCategories; diff --git a/src/poi-service/rebuild_all.sh b/src/poi-service/rebuild_all.sh index 25f4067..2ef165a 100755 --- a/src/poi-service/rebuild_all.sh +++ b/src/poi-service/rebuild_all.sh @@ -1,10 +1,16 @@ #!/bin/bash -if [ ! $COMMON_API_ROOT_DIR ] +if [ ! $COMMONAPI_TOOL_DIR ] then - echo 'Set the root dir of the common api tools' - echo 'You are supposed to build common-api-dbus-tools and common-api-tools under the same root dir' - echo 'export COMMON_API_ROOT_DIR=' + echo 'Set the dir of the common api tools' + echo 'export COMMONAPI_TOOL_DIR=' + 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=' exit 1 fi @@ -14,10 +20,8 @@ rm -rf build mkdir build cd build -OS_VERSION=$(uname -i) - echo 'build with CommonAPI' -cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DWITH_DBUS_INTERFACE=OFF -DCOMMONAPI_DBUS_TOOL_GENERATOR=$COMMON_API_ROOT_DIR/common-api-dbus-tools/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/$OS_VERSION/commonapi-dbus-generator-linux-$OS_VERSION -DCOMMONAPI_TOOL_GENERATOR=$COMMON_API_ROOT_DIR/common-api-tools/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/$OS_VERSION/commonapi-generator-linux-$OS_VERSION -DWITH_DEBUG=ON . ../ +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 . ../ make diff --git a/test/poi-service/CMakeLists.txt b/test/poi-service/CMakeLists.txt index c77a9d6..aa52baa 100644 --- a/test/poi-service/CMakeLists.txt +++ b/test/poi-service/CMakeLists.txt @@ -64,7 +64,7 @@ add_subdirectory(poi-client) add_subdirectory(poi-contentaccess-module) if(WITH_FRANCA_DBUS_INTERFACE) - set(FRANCA_DIR "${API_DIR}/franca/navigation") + set(FRANCA_DIR "${API_DIR}/franca") add_subdirectory(poi-manager-client) endif() diff --git a/test/poi-service/README b/test/poi-service/README index 026bb3c..4342517 100644 --- a/test/poi-service/README +++ b/test/poi-service/README @@ -119,9 +119,10 @@ First you need to build the poi-manager-server, see the README in ../../src/poi- cd build -NB: For the 64 bits version, replace 'x86' with 'x86_64' in the command below: +You need to pass as parameter to the cmake the link to your patched dbus library (required by CommonAPI) -cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DCOMMONAPI_DBUS_TOOL_GENERATOR=/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/x86/commonapi-dbus-generator-linux-x86 -DCOMMONAPI_TOOL_GENERATOR=/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86 -DWITH_DEBUG=ON . ../ +cd build +cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DDBUS_LIB_PATH=yourPath -DCOMMONAPI_DBUS_TOOL_DIR= -DCOMMONAPI_TOOL_DIR= -DWITH_DEBUG=ON ../ make diff --git a/test/poi-service/poi-manager-client/CMakeLists.txt b/test/poi-service/poi-manager-client/CMakeLists.txt index ba00c2f..78636b2 100644 --- a/test/poi-service/poi-manager-client/CMakeLists.txt +++ b/test/poi-service/poi-manager-client/CMakeLists.txt @@ -57,7 +57,7 @@ pkg_check_modules(GTK gtk+-3.0) # Source Files FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -add_subdirectory(${FRANCA_DIR}/poiservice "${CMAKE_CURRENT_BINARY_DIR}/franca") +add_subdirectory(${FRANCA_DIR}/navigation/poiservice "${CMAKE_CURRENT_BINARY_DIR}/franca") FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp) FILE(GLOB PRJ_STUB_GEN_TYPES ${PRJ_SRC_GEN_NAVIGATION_TYPES_PATH}/*Types*.cpp ${PRJ_SRC_GEN_POISERVICE_TYPES_PATH}/*Types*.cpp) diff --git a/test/poi-service/poi-manager-client/main.cpp b/test/poi-service/poi-manager-client/main.cpp index 9072ad5..6e59ac4 100644 --- a/test/poi-service/poi-manager-client/main.cpp +++ b/test/poi-service/poi-manager-client/main.cpp @@ -40,7 +40,7 @@ #include #include //Defined in the Common API Runtime library -#include +#include #include "poi-common-data-model.h" @@ -48,7 +48,7 @@ using namespace std; using namespace v0_1::org::genivi::navigation; using namespace poiservice; using namespace org::genivi::navigation; - +using namespace org::genivi; // class contentManager class contentManager @@ -56,7 +56,7 @@ class contentManager public: - contentManager(std::shared_ptr proxy); + contentManager(std::shared_ptr proxy); ~contentManager(); @@ -93,20 +93,20 @@ public: private: GtkWidget *mp_popupWindow; - std::shared_ptr mp_proxy; + std::shared_ptr mp_proxy; POIServiceTypes::CAMCategory m_category; POIServiceTypes::CategoryID m_category_id; std::vector m_category_ids; std::vector m_poi_ids; POIServiceTypes::PoiAddedDetails m_poi; - NavigationTypes::Locales m_locales; + NavigationTypes::Locale m_locales; std::string m_strTest; }; static contentManager *clientContentManager; -contentManager::contentManager(std::shared_ptr proxy) +contentManager::contentManager(std::shared_ptr proxy) { // test: create a new category, with a new attribute and add a poi under this category POIServiceTypes::Details categoryDetails; @@ -204,7 +204,7 @@ contentManager::~contentManager() { } -static void getVersionAsyncCallback(const CommonAPI::CallStatus& callStatus, const NavigationTypes::Version& version) +static void getVersionAsyncCallback(const CommonAPI::CallStatus& callStatus, const CommonTypes::Version& version) { if (callStatus != CommonAPI::CallStatus::SUCCESS) { cout << "Remote getVersion failed with status: " << static_cast::type>(callStatus) << endl; @@ -217,7 +217,7 @@ static void getVersionAsyncCallback(const CommonAPI::CallStatus& callStatus, con void contentManager::getServerStatus() { - function getVersion = getVersionAsyncCallback; + function getVersion = getVersionAsyncCallback; CommonAPI::CallStatus callStatus; mp_proxy->getVersionAsync(getVersionAsyncCallback); @@ -580,7 +580,7 @@ int main(int argc , char** argv ) const std::string &domain = "local"; const std::string &instance = "POIContentManager"; - std::shared_ptr myProxy = runtime->buildProxy(domain,instance); + std::shared_ptr myProxy = runtime->buildProxy(domain,instance); while (!myProxy->isAvailable()) { usleep(10); diff --git a/test/poi-service/rebuild_all.sh b/test/poi-service/rebuild_all.sh index b115d32..ac20e38 100755 --- a/test/poi-service/rebuild_all.sh +++ b/test/poi-service/rebuild_all.sh @@ -1,10 +1,16 @@ #!/bin/bash -if [ ! $COMMON_API_ROOT_DIR ] +if [ ! $COMMONAPI_TOOL_DIR ] then - echo 'Set the root dir of the common api tools' - echo 'You are supposed to build common-api-dbus-tools and common-api-tools under the same root dir' - echo 'export COMMON_API_ROOT_DIR=' + echo 'Set the dir of the common api tools' + echo 'export COMMONAPI_TOOL_DIR=' + 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=' exit 1 fi @@ -21,10 +27,8 @@ rm -rf build mkdir build cd build -OS_VERSION=$(uname -i) - echo 'build with CommonAPI' -cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DWITH_DATABASE_SUPPLIER=ON -DCOMMONAPI_DBUS_TOOL_GENERATOR=$COMMON_API_ROOT_DIR/common-api-dbus-tools/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/$OS_VERSION/commonapi-dbus-generator-linux-$OS_VERSION -DCOMMONAPI_TOOL_GENERATOR=$COMMON_API_ROOT_DIR/common-api-tools/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/$OS_VERSION/commonapi-generator-linux-$OS_VERSION -DWITH_DEBUG=ON . ../ +cmake -DWITH_FRANCA_DBUS_INTERFACE=ON -DWITH_DATABASE_SUPPLIER=ON -DCOMMONAPI_DBUS_TOOL_DIR=$COMMONAPI_DBUS_TOOL_DIR -DCOMMONAPI_TOOL_DIR=$COMMONAPI_TOOL_DIR -DWITH_DEBUG=ON . ../ make -- cgit v1.2.1