diff options
22 files changed, 596 insertions, 161 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 38a0adc..bf20060 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,9 @@ # # Update (2015/05/11) : Jonathan Maw <jonathan.maw@codethink.co.uk> # - First write +# Update (2015/08/19) : Marco Residori <marco_residori@mentor.com> +# - Added option WITH_FRANCA_SOMEIP_INTERFACE +# - Renamed WITH_FRANCA_INTERFACE to WITH_FRANCA_DBUS_INTERFACE # @licence end@ ########################################################################### cmake_minimum_required(VERSION 2.6.0) @@ -27,12 +30,14 @@ option(WITH_LOG_REPLAYER "Build the Log Replayer" ON) option(WITH_SENSORS_SERVICE "Build the Sensors Service" ON) -option(WITH_FRANCA_INTERFACE - "Build using the Franca interfaces" OFF) +option(WITH_FRANCA_DBUS_INTERFACE + "Build using the Franca DBus interfaces" OFF) +option(WITH_FRANCA_SOMEIP_INTERFACE + "Build using the Franca SomeIP interfaces" OFF) option(WITH_DBUS_INTERFACE "Build using the D-Bus interfaces" ON) option(WITH_DEBUG - "Enable the debug messages" OFF) + "Enable the debug messages" OFF) message(STATUS "---------------------------------------------------------") @@ -13,7 +13,7 @@ The Positioning repository is a collection of 6 proofs of concept: Directory Structure =============================== -enhanced-position-service //2 enhanced-position-service PoCs (one with dbus interfaces and one with commonapi interfaces) +enhanced-position-service //3 enhanced-position-service PoCs (one with dbus interfaces, one with commonapi-dbus interfaces and one one with commonapi-someip interfaces) gnss-service //gnss-service PoC log-replayer //log-replayer-PoC sensors-service //sensors-service PoC @@ -41,8 +41,16 @@ To build with tests: cmake -DWITH_TESTS=ON -DWITH_DEBUG=ON ../ make -To build with tests and with dbus interface based on Franca and CommonAPI (see below how to configure CommonAPI): -cmake -DWITH_DBUS_INTERFACE=ON -DWITH_FRANCA_INTERFACE=OFF -DWITH_TESTS=ON -DWITH_DEBUG=ON -DWITH_DLT=OFF -DCMAKE_BUILD_TYPE=Debug ../ +To build with tests and with dbus interfaces: +cmake -DWITH_DBUS_INTERFACE=ON -DWITH_FRANCA_DBUS_INTERFACE=OFF -DWITH_FRANCA_SOMEIP_INTERFACE=OFF -DWITH_TESTS=ON -DWITH_DEBUG=ON -DWITH_DLT=OFF -DCMAKE_BUILD_TYPE=Debug ../ +make + +To build with tests and with interfaces based on Franca and CommonAPI (see below how to configure CommonAPI): +cmake -DWITH_DBUS_INTERFACE=ON -DWITH_FRANCA_DBUS_INTERFACE=ON -DWITH_FRANCA_SOMEIP_INTERFACE=ON +-DWITH_TESTS=ON -DWITH_DEBUG=ON -DWITH_DLT=OFF -DCMAKE_BUILD_TYPE=Debug +-DCOMMONAPI_TOOL_GENERATOR=<path to generator> +-DCOMMONAPI_DBUS_TOOL_GENERATOR=<path to generator> +-DCOMMONAPI_SOMEIP_TOOL_GENERATOR=<path to generator> ../ make =============================== @@ -58,8 +66,10 @@ option(WITH_LOG_REPLAYER "Build the Log Replayer" ON) option(WITH_SENSORS_SERVICE "Build the Sensors Service" ON) -option(WITH_FRANCA_INTERFACE - "Build using the Franca interfaces" OFF) +option(WITH_FRANCA_DBUS_INTERFACE + "Build using the Franca DBus interfaces" OFF) +option(WITH_FRANCA_SOMEIP_INTERFACE + "Build using the Franca SomeIP interfaces" OFF) option(WITH_DBUS_INTERFACE "Build using the D-Bus interfaces" ON) option(WITH_DEBUG diff --git a/enhanced-position-service/CMakeLists.txt b/enhanced-position-service/CMakeLists.txt index e7035ae..d218e05 100644 --- a/enhanced-position-service/CMakeLists.txt +++ b/enhanced-position-service/CMakeLists.txt @@ -15,14 +15,16 @@ # # Update (2015/05/11) : Jonathan Maw <jonathan.maw@codethink.co.uk> # - First write +# Update (2015/08/19) : Marco Residori <marco_residori@mentor.com> +# - Added support of WITH_FRANCA_SOMEIP_INTERFACE and WITH_FRANCA_DBUS_INTERFACE # @licence end@ ########################################################################### cmake_minimum_required(VERSION 2.6.0) if(WITH_DBUS_INTERFACE) add_subdirectory(dbus) -endif(WITH_DBUS_INTERFACE) +endif() -if(WITH_FRANCA_INTERFACE) +if(WITH_FRANCA_DBUS_INTERFACE OR WITH_FRANCA_SOMEIP_INTERFACE) add_subdirectory(franca) -endif(WITH_FRANCA_INTERFACE) +endif() diff --git a/enhanced-position-service/dbus/test/test-scripts/run-enhanced-position-service.sh b/enhanced-position-service/dbus/test/test-scripts/run-enhanced-position-service.sh new file mode 100755 index 0000000..87ea60e --- /dev/null +++ b/enhanced-position-service/dbus/test/test-scripts/run-enhanced-position-service.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# Component Name: Positioning poC +# Author: Marco Residori +# +# Copyright (C) 2013, XS Embedded GmbH +# +# 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@ +########################################################################### + +TOP_DIR=../../.. + +BIN_DIR=$TOP_DIR/build/log-replayer/src +LOGS_DIR=$TOP_DIR/log-replayer/logs +BIN=log-replayer +LOG=geneve-cologny.log + +CMD="$BIN_DIR/$BIN $LOGS_DIR/$LOG > /dev/null 2>&1" + +usage() { + echo "Usage: " + echo " run-logreplayer.sh [option]" + echo " -d daemonize" + echo " -k kill" + echo " -h help" + echo +} + +if [ $# -ge 1 ]; then + if [ $1 = "-d" ]; then + echo "Starting log-replayer..." + eval "$CMD" & + elif [ $1 = "-k" ]; then + killall log-replayer + elif [ $1 = "-h" ]; then + usage + fi +else + echo "Starting log-replayer..." + eval "$CMD" +fi + + + diff --git a/enhanced-position-service/franca/api/CMakeLists.txt b/enhanced-position-service/franca/api/CMakeLists.txt index c201b9e..25073a9 100644 --- a/enhanced-position-service/franca/api/CMakeLists.txt +++ b/enhanced-position-service/franca/api/CMakeLists.txt @@ -28,23 +28,15 @@ option(COMMONAPI_TOOL_GENERATOR "Absolute path to CommonAPI code generator" "") option(COMMONAPI_DBUS_TOOL_GENERATOR "Absolute path to CommonAPI-DBus code generator" "") +option(COMMONAPI_SOMEIP_TOOL_GENERATOR + "Absolute path to CommonAPI-SomeIP code generator" "") set(COMMONAPI_FIDL_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(COMMONAPI_GEN_DIR "${CMAKE_BINARY_DIR}/enhanced-position-service/franca/api") -find_package(PkgConfig REQUIRED) - -include(FindPkgConfig) - -message("CMAKE_BINARY_DIR" ${CMAKE_BINARY_DIR}) -message("COMMONAPI_GEN_DIR" ${COMMONAPI_GEN_DIR}) -message("COMMONAPI_FIDL_DIR" ${COMMONAPI_FIDL_DIR}) -message("CMAKE_CURRENT_SOURCE_DIR" ${CMAKE_CURRENT_SOURCE_DIR}) - -# generate code from fidl file(GLOB FIDL_FILES "${COMMONAPI_FIDL_DIR}/*.fidl") -message("FIDL_FILES: ${FIDL_FILES}") +# generate CommonAPI generic code from fidl files if (COMMONAPI_TOOL_GENERATOR) execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} COMMAND ${COMMONAPI_TOOL_GENERATOR} -sk -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) @@ -53,13 +45,45 @@ else () message (FATAL_ERROR "Set the variable -DCOMMONAPI_TOOL_GENERATOR=<path>") endif () -if (COMMONAPI_DBUS_TOOL_GENERATOR) - execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} +# generate DBus specific code from fidl files +if (WITH_FRANCA_DBUS_INTERFACE) + + if (COMMONAPI_DBUS_TOOL_GENERATOR) + execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} COMMAND ${COMMONAPI_DBUS_TOOL_GENERATOR} -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES}) - message("COMMONAPI_DBUS_TOOL_GENERATOR=" ${COMMONAPI_DBUS_TOOL_GENERATOR}) -else () - message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_GENERATOR=<path>") + message("COMMONAPI_DBUS_TOOL_GENERATOR=" ${COMMONAPI_DBUS_TOOL_GENERATOR}) + else () + message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_GENERATOR=<path>") + endif () + endif () +# generate SomeIP specific code from fidl files +if (WITH_FRANCA_SOMEIP_INTERFACE) + + file(GLOB SOMEIP_FDEPL_FILES "${COMMONAPI_FIDL_DIR}/someip/*.fdepl") + message("SOMEIP_FDEPL_FILES: ${SOMEIP_FDEPL_FILES}") + + if (COMMONAPI_SOMEIP_TOOL_GENERATOR) + execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR} + COMMAND ${COMMONAPI_SOMEIP_TOOL_GENERATOR} -d ${COMMONAPI_GEN_DIR} ${SOMEIP_FDEPL_FILES}) + message("COMMONAPI_SOMEIP_TOOL_GENERATOR=" ${COMMONAPI_SOMEIP_TOOL_GENERATOR}) + else () + message (FATAL_ERROR "Set the variable -DCOMMONAPI_SOMEIP_TOOL_GENERATOR=<path>") + endif () + +endif () + +message("FIDL_FILES: ${FIDL_FILES}") +message("COMMONAPI_FIDL_DIR" ${COMMONAPI_FIDL_DIR}) +message("COMMONAPI_GEN_DIR" ${COMMONAPI_GEN_DIR}) +message("CMAKE_BINARY_DIR" ${CMAKE_BINARY_DIR}) +message("CMAKE_CURRENT_SOURCE_DIR" ${CMAKE_CURRENT_SOURCE_DIR}) + + + + + + diff --git a/enhanced-position-service/franca/api/EnhancedPositionService.fdepl b/enhanced-position-service/franca/api/EnhancedPositionService.fdepl deleted file mode 100644 index bb487aa..0000000 --- a/enhanced-position-service/franca/api/EnhancedPositionService.fdepl +++ /dev/null @@ -1,34 +0,0 @@ -import "platform:/plugin/org.genivi.commonapi.core/deployment/CommonAPI_deployment.fdepl" - -import "EnhancedPositionServiceTypes.fidl" -import "EnhancedPosition.fidl" -import "Configuration.fidl" -import "PositionFeedback.fidl" - -specification EnhancedPositionServiceSpec extends org.genivi.commonapi.core.deployment.deployment -{ - for enumerations { - EnumBackingType: {UseDefault, UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64} (default: UInt64); - } -} - -specification EnhancedPositionServiceSpec2 extends org.genivi.commonapi.core.deployment.deployment -{ - for methods { - CallSemantics: {synchronous, asynchronous} (default: asynchronous); - } -} - -define EnhancedPositionServiceSpec for typeCollection org.genivi.EnhancedPositionService.EnhancedPositionServiceTypes -{ - enumeration PositionInfoKey { - EnumBackingType = UInt64 - } -} - -define EnhancedPositionServiceSpec2 for interface org.genivi.EnhancedPositionService.EnhancedPosition -{ - method GetPositionInfo { - CallSemantics = asynchronous - } -}
\ No newline at end of file diff --git a/enhanced-position-service/franca/api/README b/enhanced-position-service/franca/api/README index f0d8e31..28a3053 100644 --- a/enhanced-position-service/franca/api/README +++ b/enhanced-position-service/franca/api/README @@ -6,4 +6,4 @@ Please note that the Franca interfaces described in the current folder (*.fidl) The conversion of the D-Bus interfaces into Franca interfaces have not been completed yet. The official GENIVI interfaces of the EnhancedPositionService are those defined in the D-Bus XML files -contained in the folder 'api' inside of 'dbus-service' +contained in the folder 'api' inside of 'dbus' diff --git a/enhanced-position-service/franca/api/someip/Configuration.fdepl b/enhanced-position-service/franca/api/someip/Configuration.fdepl new file mode 100644 index 0000000..f2ad101 --- /dev/null +++ b/enhanced-position-service/franca/api/someip/Configuration.fdepl @@ -0,0 +1,45 @@ +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "../Configuration.fidl" +import "../EnhancedPositionServiceTypes.fidl" + +define org.genivi.commonapi.someip.deployment for interface org.genivi.EnhancedPositionService.Configuration { + SomeIpServiceID = 1001 + + attribute SatSystem { + SomeIpGetterID = 3000 + SomeIpSetterID = 3001 + SomeIpNotifierID = 3002 + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + SomeIpEventGroups = { 3002 } + } + + attribute UpdateInterval { + SomeIpGetterID = 4000 + SomeIpSetterID = 4001 + SomeIpNotifierID = 4002 + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + SomeIpEventGroups = { 4002 } + } + + method GetVersion { + SomeIpMethodID = 5000 + SomeIpReliable = true + } + + method GetSupportedSatelliteSystems { + SomeIpMethodID = 6000 + SomeIpReliable = true + } +} + +define org.genivi.commonapi.someip.deployment for provider EnhancedPositionService { + instance org.genivi.EnhancedPositionService.Configuration { + InstanceId = "EnhancedPositionService" + SomeIpInstanceID = 2000 + SomeIpUnicastAddress = "127.0.0.1" + } +} diff --git a/enhanced-position-service/franca/api/someip/EnhancedPosition.fdepl b/enhanced-position-service/franca/api/someip/EnhancedPosition.fdepl new file mode 100644 index 0000000..62f5a5f --- /dev/null +++ b/enhanced-position-service/franca/api/someip/EnhancedPosition.fdepl @@ -0,0 +1,41 @@ +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "../EnhancedPosition.fidl" +import "../EnhancedPositionServiceTypes.fidl" + +define org.genivi.commonapi.someip.deployment for interface org.genivi.EnhancedPositionService.EnhancedPosition { + SomeIpServiceID = 1002 + + method GetVersion { + SomeIpMethodID = 5000 + SomeIpReliable = true + } + + method GetPositionInfo { + SomeIpMethodID = 6000 + SomeIpReliable = true + } + + method GetSatelliteInfo { + SomeIpMethodID = 7000 + SomeIpReliable = true + } + + method GetTime { + SomeIpMethodID = 8000 + SomeIpReliable = true + } + + broadcast PositionUpdate { + SomeIpEventID = 9000 + SomeIpReliable = true + SomeIpEventGroups = { 9000 } + } +} + +define org.genivi.commonapi.someip.deployment for provider EnhancedPositionService { + instance org.genivi.EnhancedPositionService.EnhancedPosition { + InstanceId = "EnhancedPositionService" + SomeIpInstanceID = 2000 + SomeIpUnicastAddress = "127.0.0.1" + } +} diff --git a/enhanced-position-service/franca/api/someip/EnhancedPositionServiceTypes.fdepl b/enhanced-position-service/franca/api/someip/EnhancedPositionServiceTypes.fdepl new file mode 100644 index 0000000..789a7d4 --- /dev/null +++ b/enhanced-position-service/franca/api/someip/EnhancedPositionServiceTypes.fdepl @@ -0,0 +1,9 @@ +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "../EnhancedPositionServiceTypes.fidl" + +define org.genivi.commonapi.someip.deployment for typeCollection +org.genivi.EnhancedPositionService.EnhancedPositionServiceTypes as EnhancedPositionServiceTypes { + +} + + diff --git a/enhanced-position-service/franca/api/someip/PositionFeedback.fdepl b/enhanced-position-service/franca/api/someip/PositionFeedback.fdepl new file mode 100644 index 0000000..300eff8 --- /dev/null +++ b/enhanced-position-service/franca/api/someip/PositionFeedback.fdepl @@ -0,0 +1,25 @@ +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "../PositionFeedback.fidl" +import "../EnhancedPositionServiceTypes.fidl" + +define org.genivi.commonapi.someip.deployment for interface org.genivi.EnhancedPositionService.PositionFeedback { + SomeIpServiceID = 1003 + + method GetVersion { + SomeIpMethodID = 5000 + SomeIpReliable = true + } + + method SetPositionFeedback { + SomeIpMethodID = 6000 + SomeIpReliable = true + } +} + +define org.genivi.commonapi.someip.deployment for provider EnhancedPositionService { + instance org.genivi.EnhancedPositionService.PositionFeedback { + InstanceId = "EnhancedPositionService" + SomeIpInstanceID = 2000 + SomeIpUnicastAddress = "127.0.0.1" + } +} diff --git a/enhanced-position-service/franca/res/EnhancedPositionService.json b/enhanced-position-service/franca/res/EnhancedPositionService.json new file mode 100644 index 0000000..a77e01c --- /dev/null +++ b/enhanced-position-service/franca/res/EnhancedPositionService.json @@ -0,0 +1,104 @@ +{ + "unicast" : "192.168.0.101", + "logging" : + { + "level" : "debug", + "console" : "true", + "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" }, + "dlt" : "false" + }, + "applications" : + [ + { + "name" : "EnhancedPositionService", + "id" : "0x4444" + }, + { + "name" : "EnhancedPositionClient", + "id" : "0x5555" + } + ], + "servicegroups" : + [ + { + "name" : "default", + "delays" : + { + "initial" : { "minimum" : "10", "maximum" : "100" }, + "repetition-base" : "200", + "repetition-max" : "3", + "cyclic-offer" : "2000", + "cyclic-request" : "2001" + }, + "services" : + [ + { + "service" : "0x3E9", + "instance" : "0x7D0", + "unreliable" : "30509", + "events" : + [ + { + "event" : "0xbba", + "is_field" : "true" + }, + { + "event" : "0xfa2", + "is_field" : "true" + } + ], + "eventgroups" : + [ + { + "eventgroup" : "0xbba", + "events" : [ "0xbba" ] + }, + { + "eventgroup" : "0xfa2", + "events" : [ "0xfa2" ] + } + ] + } + ], + "services" : + [ + { + "service" : "0x3EA", + "instance" : "0x7D0", + "unreliable" : "30509", + "events" : + [ + { + "event" : "0x2328", + "is_field" : "true" + } + ], + "eventgroups" : + [ + { + "eventgroup" : "0x2328", + "events" : [ "0x2328" ] + } + ] + } + ], + "services" : + [ + { + "service" : "0x3EB", + "instance" : "0x7D0", + "unreliable" : "30509" + } + ] + } + ], + "routing" : "EnhancedPositionService", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.244.224.245", + "port" : "30490", + "protocol" : "udp" + } +} + diff --git a/enhanced-position-service/franca/res/README b/enhanced-position-service/franca/res/README deleted file mode 100644 index 700fb57..0000000 --- a/enhanced-position-service/franca/res/README +++ /dev/null @@ -1,7 +0,0 @@ - -Copy the configuration file commonapi-dbus.ini in a directory of your choice - -Set the environment variable COMMONAPI_DBUS_DEFAULT_CONFIG before starting the EnhancedPositionService. - -Example: -export COMMONAPI_DBUS_DEFAULT_CONFIG=<your path>/commonapi-dbus.ini diff --git a/enhanced-position-service/franca/res/commonapi4dbus.ini b/enhanced-position-service/franca/res/commonapi4dbus.ini new file mode 100644 index 0000000..1e5b30b --- /dev/null +++ b/enhanced-position-service/franca/res/commonapi4dbus.ini @@ -0,0 +1,4 @@ +[default] +binding=dbus + + diff --git a/enhanced-position-service/franca/res/commonapi4someip.ini b/enhanced-position-service/franca/res/commonapi4someip.ini new file mode 100644 index 0000000..b696392 --- /dev/null +++ b/enhanced-position-service/franca/res/commonapi4someip.ini @@ -0,0 +1,4 @@ +[default] +binding=someip + + diff --git a/enhanced-position-service/franca/src/CMakeLists.txt b/enhanced-position-service/franca/src/CMakeLists.txt index e9b17f6..64ab99c 100755 --- a/enhanced-position-service/franca/src/CMakeLists.txt +++ b/enhanced-position-service/franca/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2014 BMW Group +# Copyright (C) 2015 Mentor Graphics # Author: Marco Residori (marco_residori@mentor.com) # 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 @@ -6,99 +6,190 @@ cmake_minimum_required(VERSION 2.8) find_package(PkgConfig REQUIRED) +include(FindPkgConfig) # Project settings set(PROJECT_NAME EnhancedPosition) +set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client) +set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service) project(${PROJECT_NAME}) set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_CXX_FLAGS "-Wall -std=c++0x") set(CMAKE_BUILD_TYPE Debug) -message(STATUS "ENHANCED-POSITION-SERVICE-FRANCA") +find_package(CommonAPI 3.1.3 REQUIRED) + message(STATUS "WITH_DLT = ${WITH_DLT}") message(STATUS "WITH_GPSD = ${WITH_GPSD}") message(STATUS "WITH_REPLAYER = ${WITH_REPLAYER}") message(STATUS "WITH_TESTS = ${WITH_TESTS}") message(STATUS "WITH_DEBUG = ${WITH_DEBUG}") - -find_package(PkgConfig REQUIRED) -find_package(CommonAPI 3.1.3 REQUIRED) -find_package(CommonAPI-DBus 3.1.3 REQUIRED) - -# CommonAPI -include(FindPkgConfig) -pkg_check_modules (DBUS "dbus-1 >= 1.4") -pkg_check_modules(COMMONAPI "CommonAPI >= 3.1") -pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 3.1") +message(STATUS "WITH_FRANCA_DBUS_INTERFACE = ${WITH_FRANCA_DBUS_INTERFACE}") +message(STATUS "WITH_FRANCA_SOMEIP_INTERFACE = ${WITH_FRANCA_SOMEIP_INTERFACE}") # Source Files set(PRJ_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(PRJ_SRC_GEN_ROOT ${CMAKE_BINARY_DIR}/enhanced-position-service/franca/api) set(PRJ_SRC_GEN_PATH ${PRJ_SRC_GEN_ROOT}/org/genivi/EnhancedPositionService) -set(PRJ_NAME_CLIENT ${PROJECT_NAME}Client) -set(PRJ_NAME_SERVICE ${PROJECT_NAME}Service) - -FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Proxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp) -FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*Stub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp) -FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*Stub*.cpp) - -set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS}) -set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) - -message(STATUS "PRJ_SRC_GEN_ROOT = " ${PRJ_SRC_GEN_ROOT}) -message(STATUS "PRJ_SRC_PATH = " ${PRJ_SRC_PATH}) -message(STATUS "PRJ_SRC_GEN_PATH = " ${PRJ_SRC_GEN_PATH}) -message(STATUS "COMMONAPI_INCLUDE_DIRS = " ${COMMONAPI_INCLUDE_DIRS}) -message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS = " ${COMMONAPI_DBUS_INCLUDE_DIRS}) -message(STATUS "PRJ_CLIENT_SRCS = " ${PRJ_CLIENT_SRCS}) -message(STATUS "PRJ_SERVICE_SRCS = " ${PRJ_SERVICE_SRCS}) - -include_directories( - ${PRJ_SRC_GEN_ROOT} - ${DBUS_INCLUDE_DIRS} - ${COMMONAPI_INCLUDE_DIRS} - ${COMMONAPI_DBUS_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} - ${gnss-service_INCLUDE_DIRS} - ${sensors-service_INCLUDE_DIRS} -) - -link_directories( - ${DBUS_LIBDIR} - ${gnss-service_LIBRARY_DIRS} - ${sensors-service_LIBRARY_DIRS} - ${COMMONAPI_LIBDIR} - ${COMMONAPI_DBUS_LIBDIR} -) - -set(LIBRARIES - ${DBUS_LIBRARIES} - ${gnss-service_LIBRARIES} - ${sensors-service_LIBRARIES} - CommonAPI - CommonAPI-DBus -) - -if(WITH_DLT) - add_definitions("-DDLT_ENABLED=1") - set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/..") - find_package(DLT REQUIRED) - include_directories( ${DLT_INCLUDE_DIRS} ) - set(LIBRARIES ${LIBRARIES} ${DLT_LIBRARIES}) +if (WITH_FRANCA_DBUS_INTERFACE) + + message(STATUS "ENHANCED-POSITION-SERVICE-FRANCA-DBUS") + + find_package(CommonAPI-DBus 3.1.3 REQUIRED) + + # CommonAPI + pkg_check_modules (DBUS "dbus-1 >= 1.4") + pkg_check_modules (COMMONAPI "CommonAPI >= 3.1") + pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 3.1") + + FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*DBusProxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/*DBusDeployment.cpp) + FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_PATH}/*StubDefault.cpp) + FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*Stub*.cpp) + + set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS}) + set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) + + message(STATUS "PRJ_SRC_GEN_ROOT = " ${PRJ_SRC_GEN_ROOT}) + message(STATUS "PRJ_SRC_PATH = " ${PRJ_SRC_PATH}) + message(STATUS "PRJ_SRC_GEN_PATH = " ${PRJ_SRC_GEN_PATH}) + message(STATUS "COMMONAPI_INCLUDE_DIRS = " ${COMMONAPI_INCLUDE_DIRS}) + message(STATUS "COMMONAPI_DBUS_INCLUDE_DIRS = " ${COMMONAPI_DBUS_INCLUDE_DIRS}) + message(STATUS "PRJ_CLIENT_SRCS = " ${PRJ_CLIENT_SRCS}) + message(STATUS "PRJ_SERVICE_SRCS = " ${PRJ_SERVICE_SRCS}) + + include_directories( + ${PRJ_SRC_GEN_ROOT} + ${DBUS_INCLUDE_DIRS} + ${COMMONAPI_INCLUDE_DIRS} + ${COMMONAPI_DBUS_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${gnss-service_INCLUDE_DIRS} + ${sensors-service_INCLUDE_DIRS} + ) + + link_directories( + ${DBUS_LIBDIR} + ${COMMONAPI_LIBDIR} + ${COMMONAPI_DBUS_LIBDIR} + ${gnss-service_LIBRARY_DIRS} + ${sensors-service_LIBRARY_DIRS} + ) + + set(LIBRARIES + ${DBUS_LIBRARIES} + CommonAPI + CommonAPI-DBus + ${gnss-service_LIBRARIES} + ${sensors-service_LIBRARIES} + ) + + if(WITH_DLT) + add_definitions("-DDLT_ENABLED=1") + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/..") + find_package(DLT REQUIRED) + include_directories( ${DLT_INCLUDE_DIRS} ) + set(LIBRARIES ${LIBRARIES} ${DLT_LIBRARIES}) + endif() + + if(WITH_DEBUG) + add_definitions("-DDEBUG_ENABLED=1") + endif() + + # Build Client + add_executable(${PRJ_NAME_CLIENT}DBus ${PRJ_CLIENT_SRCS}) + target_link_libraries(${PRJ_NAME_CLIENT}DBus ${LIBRARIES}) + + # Build service + add_executable(${PRJ_NAME_SERVICE}DBus ${PRJ_SERVICE_SRCS}) + target_link_libraries(${PRJ_NAME_SERVICE}DBus ${LIBRARIES}) endif() -if(WITH_DEBUG) - add_definitions("-DDEBUG_ENABLED=1") +if (WITH_FRANCA_SOMEIP_INTERFACE) + + message(STATUS "ENHANCED-POSITION-SERVICE-FRANCA-SOMEIP") + + find_package( Boost 1.54 COMPONENTS system thread log REQUIRED ) + find_package (CommonAPI-SomeIP 3.1.3 REQUIRED) + + # CommonAPI + pkg_check_modules (COMMONAPI_SOMEIP "CommonAPI-Someip >= 3.1") + + FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*SomeIPProxy.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/*SomeIPDeployment.cpp) + FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/*SomeIPStub*.cpp ${PRJ_SRC_GEN_PATH}/*Types.cpp ${PRJ_SRC_GEN_PATH}/*SomeIPDeployment.cpp ${PRJ_SRC_GEN_PATH}/*StubDefault.cpp) + FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*Stub*.cpp) + + set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS}) + set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) + + message(STATUS "CMAKE_CURRENT_SOURCE_DIR = " ${CMAKE_CURRENT_SOURCE_DIR}) + + message(STATUS "PRJ_SRC_GEN_ROOT = " ${PRJ_SRC_GEN_ROOT}) + message(STATUS "PRJ_SRC_PATH = " ${PRJ_SRC_PATH}) + message(STATUS "PRJ_SRC_GEN_PATH = " ${PRJ_SRC_GEN_PATH}) + + message(STATUS "COMMONAPI_INCLUDE_DIRS = " ${COMMONAPI_INCLUDE_DIRS}) + message(STATUS "COMMONAPI_LIBRARIES = " ${COMMONAPI_LIBRARIES}) + message(STATUS "COMMONAPI_LIBDIR = " ${COMMONAPI_LIBDIR}) + + message(STATUS "PRJ_CLIENT_SRCS = " ${PRJ_CLIENT_SRCS}) + message(STATUS "PRJ_SERVICE_SRCS = " ${PRJ_SERVICE_SRCS}) + + message(STATUS "COMMONAPI_SOMEIP_INCLUDE_DIRS = " ${COMMONAPI_SOMEIP_INCLUDE_DIRS}) + message(STATUS "COMMONAPI_SOMEIP_LIBRARIES = " ${COMMONAPI_SOMEIP_LIBRARIES}) + message(STATUS "COMMONAPI_SOMEIP_LIBDIR = " ${COMMONAPI_SOMEIP_LIBDIR}) + + include_directories( + ${Boost_INCLUDE_DIR} + ${PRJ_SRC_GEN_ROOT} + ${SOMEIP_INCLUDE_DIRS} + ${COMMONAPI_INCLUDE_DIRS} + ${COMMONAPI_SOMEIP_INCLUDE_DIRS} + ${VSOMEIP_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${gnss-service_INCLUDE_DIRS} + ${sensors-service_INCLUDE_DIRS} + ) + + link_directories( + ${gnss-service_LIBRARY_DIRS} + ${sensors-service_LIBRARY_DIRS} + ${COMMONAPI_LIBDIR} + ${VSOMEIP_LIBDIR} + ${COMMONAPI_SOMEIP_LIBDIR} + "/usr/local/lib" + ) + + set(LIBRARIES + ${COMMONAPI_LIBRARIES} + ${COMMONAPI_SOMEIP_LIBRARIES} + ${gnss-service_LIBRARIES} + ${sensors-service_LIBRARIES} + CommonAPI + CommonAPI-SomeIP + ) + + if(WITH_DLT) + add_definitions("-DDLT_ENABLED=1") + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/..") + find_package(DLT REQUIRED) + include_directories( ${DLT_INCLUDE_DIRS} ) + set(LIBRARIES ${LIBRARIES} ${DLT_LIBRARIES}) + endif() + + if(WITH_DEBUG) + add_definitions("-DDEBUG_ENABLED=1") + endif() + + # Build Client + add_executable(${PRJ_NAME_CLIENT}SomeIP ${PRJ_CLIENT_SRCS}) + target_link_libraries(${PRJ_NAME_CLIENT}SomeIP ${LIBRARIES}) + + # Build service + add_executable(${PRJ_NAME_SERVICE}SomeIP ${PRJ_SERVICE_SRCS}) + target_link_libraries(${PRJ_NAME_SERVICE}SomeIP ${LIBRARIES}) endif() -# Build Client -add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS}) -target_link_libraries(${PRJ_NAME_CLIENT} ${LIBRARIES}) - -# Build service -add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS}) -target_link_libraries(${PRJ_NAME_SERVICE} ${LIBRARIES}) diff --git a/enhanced-position-service/franca/src/EnhancedPositionClient.cpp b/enhanced-position-service/franca/src/EnhancedPositionClient.cpp index 42324a8..8f93c9b 100755 --- a/enhanced-position-service/franca/src/EnhancedPositionClient.cpp +++ b/enhanced-position-service/franca/src/EnhancedPositionClient.cpp @@ -59,11 +59,12 @@ void positionUpdate(std::shared_ptr<EnhancedPositionProxyDefault> proxy, const E } std::function<void(const CommonAPI::CallStatus&, - const EnhancedPositionServiceTypes::Timestamp&, - const EnhancedPositionServiceTypes::PositionInfo&)> fcb = getPositionInfoAsyncCallback; + const EnhancedPositionServiceTypes::Timestamp&, + const EnhancedPositionServiceTypes::PositionInfo&)> fcb = getPositionInfoAsyncCallback; proxy->GetPositionInfoAsync(changedValues,getPositionInfoAsyncCallback); + LOG_INFO_MSG(gCtx,"Position Update finished"); } int main() { @@ -73,10 +74,12 @@ int main() { std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); - const std::string &domain = "local"; - const std::string &instance = "EnhancedPositionService"; + const std::string domain = "local"; + const std::string instance = "EnhancedPositionService"; + const std::string connection = "EnhancedPositionClient"; - std::shared_ptr<EnhancedPositionProxyDefault> myProxy = runtime->buildProxy<EnhancedPositionProxy>(domain,instance); + std::shared_ptr<EnhancedPositionProxyDefault> myProxy = + runtime->buildProxy<EnhancedPositionProxy>(domain, instance); LOG_INFO_MSG(gCtx,"EnhancedPositionClient"); @@ -84,12 +87,14 @@ int main() { usleep(10); } + std::cout << "Proxy available" << std::endl; + myProxy->getPositionUpdateEvent().subscribe([&](const EnhancedPositionServiceTypes::Bitmask& changedValues) { positionUpdate(myProxy, changedValues); }); while (true) { - std::this_thread::sleep_for(std::chrono::seconds(5)); + std::this_thread::sleep_for(std::chrono::seconds(20)); } return 0; diff --git a/enhanced-position-service/franca/src/EnhancedPositionService.cpp b/enhanced-position-service/franca/src/EnhancedPositionService.cpp index 22a83cf..6b32736 100755 --- a/enhanced-position-service/franca/src/EnhancedPositionService.cpp +++ b/enhanced-position-service/franca/src/EnhancedPositionService.cpp @@ -24,30 +24,29 @@ int main() { std::string domain = "local"; std::string instance = "EnhancedPositionService"; - std::string connection = "EnhancedPositionService"; std::shared_ptr<EnhancedPositionStubImpl> myServiceEnhancedPosition = std::make_shared<EnhancedPositionStubImpl>(); - bool successfullyRegistered = runtime->registerService(domain, instance, myServiceEnhancedPosition, connection); + bool successfullyRegistered = runtime->registerService(domain, instance, myServiceEnhancedPosition); while (!successfullyRegistered) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); - successfullyRegistered = runtime->registerService(domain, instance, myServiceEnhancedPosition, connection); + successfullyRegistered = runtime->registerService(domain, instance, myServiceEnhancedPosition); } myServiceEnhancedPosition->run(); std::shared_ptr<PositionFeedbackStubImpl> myServicePositionFeedback = std::make_shared<PositionFeedbackStubImpl>(); - successfullyRegistered = runtime->registerService(domain, instance, myServicePositionFeedback, connection); + successfullyRegistered = runtime->registerService(domain, instance, myServicePositionFeedback); while (!successfullyRegistered) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); - successfullyRegistered = runtime->registerService(domain, instance, myServicePositionFeedback, connection); + successfullyRegistered = runtime->registerService(domain, instance, myServicePositionFeedback); } myServicePositionFeedback->run(); std::shared_ptr<ConfigurationStubImpl> myServiceConfiguration = std::make_shared<ConfigurationStubImpl>(); - successfullyRegistered = runtime->registerService(domain, instance, myServiceConfiguration, connection); + successfullyRegistered = runtime->registerService(domain, instance, myServiceConfiguration); while (!successfullyRegistered) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); - successfullyRegistered = runtime->registerService(domain, instance, myServiceConfiguration, connection); + successfullyRegistered = runtime->registerService(domain, instance, myServiceConfiguration); } myServiceConfiguration->run(); diff --git a/enhanced-position-service/franca/test/test-scripts/run-test.sh b/enhanced-position-service/franca/test/test-scripts/run-test-dbus.sh index 6f14cf5..1fe51a9 100755 --- a/enhanced-position-service/franca/test/test-scripts/run-test.sh +++ b/enhanced-position-service/franca/test/test-scripts/run-test-dbus.sh @@ -22,25 +22,28 @@ TOP_DIR=../../../.. LOGS_DIR=$TOP_DIR/log-replayer/logs LOGREPLAYER_DIR=$TOP_DIR/build/log-replayer/src ENHPOS_DIR=$TOP_DIR/build/enhanced-position-service/franca/src -ENHPOS_CONFIG=$TOP_DIR/enhanced-position-service/franca/res/commonapi-dbus.ini +ENHPOS_RES=$TOP_DIR/enhanced-position-service/franca/res echo "Test started" $LOGREPLAYER_DIR/log-replayer $LOGS_DIR/geneve-cologny.log > /dev/null 2>&1 & -export COMMONAPI_DBUS_DEFAULT_CONFIG=$ENHPOS_CONFIG -$ENHPOS_DIR/EnhancedPositionService & +COMMONAPI_DEFAULT_CONFIG=$ENHPOS_RES/commonapi4dbus.ini \ +COMMONAPI_DBUS_DEFAULT_CONFIG=$ENHPOS_RES/commonapi-dbus.ini \ +$ENHPOS_DIR/EnhancedPositionServiceDBus & sleep 1 -$ENHPOS_DIR/EnhancedPositionClient & +COMMONAPI_DEFAULT_CONFIG=$ENHPOS_RES/commonapi4dbus.ini \ +COMMONAPI_DBUS_DEFAULT_CONFIG=$ENHPOS_RES/commonapi-dbus.ini \ +$ENHPOS_DIR/EnhancedPositionClientDBus & sleep 10 echo "Test finished" -killall EnhancedPositionClient -killall EnhancedPositionService +killall EnhancedPositionClientDBus +killall EnhancedPositionServiceDBus killall log-replayer diff --git a/enhanced-position-service/franca/test/test-scripts/run-test-someip.sh b/enhanced-position-service/franca/test/test-scripts/run-test-someip.sh new file mode 100755 index 0000000..06ff8cd --- /dev/null +++ b/enhanced-position-service/franca/test/test-scripts/run-test-someip.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# Component Name: EnhancedPositionService +# Author: Marco Residori +# +# Copyright (C) 2015, XS Embedded GmbH +# +# 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@ +########################################################################### + +TOP_DIR=../../../.. + +LOGS_DIR=$TOP_DIR/log-replayer/logs +LOGREPLAYER_DIR=$TOP_DIR/build/log-replayer/src +ENHPOS_DIR=$TOP_DIR/build/enhanced-position-service/franca/src +ENHPOS_RES=$TOP_DIR/enhanced-position-service/franca/res + +echo "Test started" + +$LOGREPLAYER_DIR/log-replayer $LOGS_DIR/geneve-cologny.log > /dev/null 2>&1 & + +COMMONAPI_DEFAULT_CONFIG=$ENHPOS_RES/commonapi4someip.ini \ +VSOMEIP_CONFIGURATION_FILE=$ENHPOS_RES/EnhancedPositionService.json \ +VSOMEIP_APPLICATION_NAME=EnhancedPositionService \ +$ENHPOS_DIR/EnhancedPositionServiceSomeIP & + +sleep 1 + +COMMONAPI_DEFAULT_CONFIG=$ENHPOS_RES/commonapi4someip.ini \ +VSOMEIP_CONFIGURATION_FILE=$ENHPOS_RES/EnhancedPositionService.json \ +VSOMEIP_APPLICATION_NAME=EnhancedPositionClient \ +$ENHPOS_DIR/EnhancedPositionClientSomeIP & + +sleep 10 + +echo "Test finished" + +killall EnhancedPositionClientSomeIP +killall EnhancedPositionServiceSomeIP +killall log-replayer + + diff --git a/position-web-service/src/plugin/fbprojects/PositionWebService/CMakeLists.txt b/position-web-service/src/plugin/fbprojects/PositionWebService/CMakeLists.txt index 6021dfd..e40c112 100755 --- a/position-web-service/src/plugin/fbprojects/PositionWebService/CMakeLists.txt +++ b/position-web-service/src/plugin/fbprojects/PositionWebService/CMakeLists.txt @@ -34,6 +34,7 @@ set(ENHANCED_POS_SERVICE_API ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../enhanced message(STATUS "ENHANCED_POS_SERVICE_API: " ${ENHANCED_POS_SERVICE_API}) message(STATUS "BINARY DIR: " ${CMAKE_CURRENT_BINARY_DIR}) +message(STATUS "BINARY DIR: " ${DBUS_CPP_INCLUDE_DIRS}) add_custom_target ( interfaceGenerator ALL diff --git a/run-test.sh b/run-test.sh index b7bc726..3611245 100755 --- a/run-test.sh +++ b/run-test.sh @@ -84,8 +84,8 @@ testEnhancedPositionService2() echo 'Starting enhanced position service...' $LOG_REPLAYER_BIN_DIR/src/log-replayer $LOG_REPLAYER_LOGS_DIR/geneve-cologny.log > /dev/null 2>&1 & echo 'Starting log replayer...' - $ENHANCED_POSITION_SERVICE_DBUS_BIN_DIR/src/enhanced-position-service > /dev/null 2>&1 & - sleep 10 + $ENHANCED_POSITION_SERVICE_DBUS_BIN_DIR/src/enhanced-position-service & + sleep 1000 echo 'Stopping test...' killall enhanced-position-service killall log-replayer |