diff options
-rw-r--r-- | CMakeLists.txt | 51 | ||||
-rw-r--r-- | README | 84 | ||||
-rwxr-xr-x | build-all.sh | 157 | ||||
-rw-r--r-- | enhanced-position-service/CMakeLists.txt | 28 | ||||
-rw-r--r-- | enhanced-position-service/dbus/CMakeLists.txt | 6 | ||||
-rw-r--r-- | enhanced-position-service/dbus/api/CMakeLists.txt | 15 | ||||
-rw-r--r-- | enhanced-position-service/dbus/src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | enhanced-position-service/dbus/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | enhanced-position-service/dbus/test/compliance-test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gnss-service/CMakeLists.txt | 16 | ||||
-rw-r--r-- | gnss-service/src/CMakeLists.txt | 14 | ||||
-rwxr-xr-x | gnss-service/test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gnss-service/test/compliance-test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | log-replayer/CMakeLists.txt | 13 | ||||
-rw-r--r-- | log-replayer/src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | log-replayer/src/log-replayer.c | 32 | ||||
-rw-r--r-- | log-replayer/test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | sensors-service/CMakeLists.txt | 9 | ||||
-rw-r--r-- | sensors-service/src/CMakeLists.txt | 24 | ||||
-rw-r--r-- | sensors-service/test/CMakeLists.txt | 4 |
20 files changed, 208 insertions, 263 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5d2e8c9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# Component Name: Positioning Top-level Makefile +# +# Author: Jonathan Maw +# +# Copyright (C) 2015, Codethink Ltd +# +# 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/. +# +# Update (2015/05/11) : Jonathan Maw <jonathan.maw@codethink.co.uk> +# - First write +# @licence end@ +########################################################################### +cmake_minimum_required(VERSION 2.6.0) + +option(WITH_ENHANCED_POSITION_SERVICE + "Build the Enhanced Positioning Service" ON) +option(WITH_GNSS_SERVICE + "Build the GNSS Service" ON) +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_DBUS_INTERFACE + "Build using the D-Bus interfaces" ON) +option(WITH_DEBUG + "Enable the debug messages" OFF) + +if(WITH_ENHANCED_POSITION_SERVICE) + add_subdirectory(enhanced-position-service) +endif(WITH_ENHANCED_POSITION_SERVICE) + +if(WITH_GNSS_SERVICE) + add_subdirectory(gnss-service) +endif(WITH_GNSS_SERVICE) + +if(WITH_LOG_REPLAYER) + add_subdirectory(log-replayer) +endif(WITH_LOG_REPLAYER) + +if(WITH_SENSORS_SERVICE) + add_subdirectory(sensors-service) +endif(WITH_SENSORS_SERVICE) @@ -8,7 +8,6 @@ The Positioning repository is a collection of 5 proofs of concept: * EnhancedPositionService * LogReplayer - =============================== Directory Structure =============================== @@ -28,30 +27,60 @@ How To Build =============================== To build the positioning proofs of concept please follow the following steps: +First create and enter the build folder +mkdir ./build +cd build -./build-all.sh - -or +To build: +cmake ../ +make -./build-all.sh [command] [service] +To build with tests: +cmake -DWITH_TESTS=ON -DWITH_DEBUG=ON ../ +make -command: - make Build - clean Clean - help Print Help +To build with tests and with dbus interface based on Franca and CommonAPI (see below how to configure CommonAPI): +cmake -DWITH_DBUS_INTERFACE=OFF -DWITH_FRANCA_INTERFACE=ON -DWITH_TESTS=ON -DWITH_DEBUG=ON ../ +make -service: - gnss Test GNSSService - sns Test SensorsService - enhpos Test EnhancedPositionService - repl Test Replayer +=============================== +Compiler Options and default setting +(see dependencies below) +=============================== +option(WITH_ENHANCED_POSITION_SERVICE + "Build the Enhanced Positioning Service" ON) +option(WITH_GNSS_SERVICE + "Build the GNSS Service" ON) +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_DBUS_INTERFACE + "Build using the D-Bus interfaces" ON) +option(WITH_DEBUG + "Enable the debug messages" OFF) +option(WITH_DLT + "Enable DLT logging" OFF) +option(WITH_GPSD + "Use GPSD as source of GPS data" OFF) +option(WITH_REPLAYER + "Use REPLAYER as source of GPS data" ON) +option(WITH_TESTS + "Compile test applications" OFF) +option(WITH_IPHONE + "Use IPHONE as source of sensors data" OFF) + +Just set the option to ON or OFF on the command line. =============================== How To Test =============================== -To test the positioning proofs of concept please use the following test application: +To test the positioning proofs of concept please use the following test application (under top folder): +(please note that you need to build with -DWITH_TESTS=ON and -DWITH_DEBUG=ON to see something displayed) ./run-test.sh [command] @@ -63,40 +92,21 @@ service: kill Kill all test applications help Print Help - =============================== -Compiler Options -=============================== - -If you wish to change the default cmake-options, please -1) open the file build-all.sh, -2) edit the compiler flags, -3) delete the build directory, -4) recompile the code from scratch. - --------------------- -Example --------------------- - -If you wish to activate DLT logging for the GNSSService, just change the -value of GNSS_SERVICE_FLAGS in the file build-all.sh as follows: -GNSS_SERVICE_FLAGS='-DWITH_DLT=ON' - --------------------- Dependencies --------------------- +=============================== DWITH_GPSD=ON requires that the package 'gpsd' is installed. To install 'gpsd', please execute the following commands: sudo apt-get install gpsd sudo apt-get install libgps-dev -To test the enhanced-positon-service (dbus-service) the packages 'libdbus-c++-dev' and 'xsltproc' must be installed. +To test the enhanced-position-service (dbus-service) the packages 'libdbus-c++-dev' and 'xsltproc' must be installed. To install these packages, please execute the following commands: sudo apt-get install libdbus-c++-dev sudo apt-get install xsltproc -To test the enhanced-positon-service (commonapi-service) the package CommonAPI must be installed. +To test the enhanced-position-service (commonapi-service) the package CommonAPI must be installed. To install CommonAPI, please see http://git.projects.genivi.org/?p=ipc/common-api-dbus-runtime.git;a=blob;f=README DWITH_TESTS=ON enables the compilation of the test application(s). diff --git a/build-all.sh b/build-all.sh deleted file mode 100755 index 0ac24c5..0000000 --- a/build-all.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/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/. -# -# Update (2014/12/02) : Philippe Colliot <philippe.colliot@mpsa.com>, -# PSA Peugeot Citroen -# - introduce debug flag to enable verbosity -# - generate the API of enhanced-position-service into the API folder -# @licence end@ -########################################################################### - -#-------------------------------------------------------------------------- -# Compiler Flags -#-------------------------------------------------------------------------- -# modify the following flags as needed: -GNSS_SERVICE_FLAGS='-DWITH_DLT=OFF -DWITH_GPSD=OFF -DWITH_REPLAYER=ON -DWITH_TESTS=ON -DWITH_DEBUG=ON' -SENSORS_SERVICE_FLAGS='-DWITH_DLT=OFF -DWITH_REPLAYER=ON -DWITH_IPHONE=OFF -DWITH_TESTS=ON -DWITH_DEBUG=ON' -ENHANCED_POSITION_SERVICE_FLAGS='-DWITH_DLT=OFF -DWITH_GPSD=OFF -DWITH_REPLAYER=ON -DWITH_IPHONE=OFF -DWITH_TESTS=ON -DWITH_DEBUG=ON' -LOG_REPLAYER_FLAGS='-DWITH_DLT=OFF -DWITH_TESTS=ON -DWITH_DEBUG=ON' -#-------------------------------------------------------------------------- - -TOP_SRC_DIR=$PWD -TOP_BIN_DIR=$PWD/build - -GNSS_SERVICE_SRC_DIR=$TOP_SRC_DIR/gnss-service -SENSORS_SERVICE_SRC_DIR=$TOP_SRC_DIR/sensors-service -ENHANCED_POSITION_SERVICE_DBUS_SRC_DIR=$TOP_SRC_DIR/enhanced-position-service/dbus -ENHANCED_POSITION_SERVICE_FRANCA_SRC_DIR=$TOP_SRC_DIR/enhanced-position-service/franca -LOG_REPLAYER_SRC_DIR=$TOP_SRC_DIR/log-replayer - -GNSS_SERVICE_BIN_DIR=$TOP_BIN_DIR/gnss-service -SENSORS_SERVICE_BIN_DIR=$TOP_BIN_DIR/sensors-service -ENHANCED_POSITION_SERVICE_DBUS_BIN_DIR=$TOP_BIN_DIR/enhanced-position-service/dbus -ENHANCED_POSITION_SERVICE_FRANCA_BIN_DIR=$TOP_BIN_DIR/enhanced-position-service/franca -LOG_REPLAYER_BIN_DIR=$TOP_BIN_DIR/log-replayer - -usage() { - echo "Usage: ./build-all.sh Build all services" - echo " or: ./build-all.sh [command] [service]" - echo - echo "command:" - echo " make Build" - echo " clean Clean" - echo " help Print Help" - echo - echo "service:" - echo " gnss Test GNSSService" - echo " sns Test SensorsService" - echo " enhpos Test EnhancedPositionServiceDBus" - echo " repl Test LogReplayer" - echo -} - -buildGnssService() { - echo '' - echo 'Building GNSSService ->' $GNSS_SERVICE_SRC_DIR - mkdir -p $GNSS_SERVICE_BIN_DIR - cd $GNSS_SERVICE_BIN_DIR - cmake $GNSS_SERVICE_FLAGS $GNSS_SERVICE_SRC_DIR && make -} - -buildSensorsService() { - echo '' - echo 'Building SensorsService ->' $SENSORS_SERVICE_SRC_DIR - mkdir -p $SENSORS_SERVICE_BIN_DIR - cd $SENSORS_SERVICE_BIN_DIR - cmake $SENSORS_SERVICE_FLAGS $SENSORS_SERVICE_SRC_DIR && make -} - -buildEnhancedPositionService() { - echo '' - echo 'Building EnhancedPositionService (D-Bus PoC) ->' $SENSORS_SERVICE_SRC_DIR - mkdir -p $ENHANCED_POSITION_SERVICE_DBUS_BIN_DIR - cd $ENHANCED_POSITION_SERVICE_DBUS_BIN_DIR - cmake $ENHANCED_POSITION_SERVICE_FLAGS $ENHANCED_POSITION_SERVICE_DBUS_SRC_DIR && make - - echo '' - echo 'Building EnhancedPositionService (Franca PoC) ->' $SENSORS_SERVICE_SRC_DIR - mkdir -p $ENHANCED_POSITION_SERVICE_FRANCA_BIN_DIR - cd $ENHANCED_POSITION_SERVICE_FRANCA_BIN_DIR - cmake $ENHANCED_POSITION_SERVICE_FLAGS $ENHANCED_POSITION_SERVICE_FRANCA_SRC_DIR && make -} - -buildLogReplayer() { - echo '' - echo 'Building LogReplayer ->' $LOG_REPLAYER_SRC_DIR - mkdir -p $LOG_REPLAYER_BIN_DIR - cd $LOG_REPLAYER_BIN_DIR - cmake $LOG_REPLAYER_FLAGS $LOG_REPLAYER_SRC_DIR && make -} - -buildAll() { - buildGnssService - buildSensorsService - buildEnhancedPositionService - buildLogReplayer -} - -cleanAll() { - rm -rf $TOP_BIN_DIR -} - -if [ $# -ge 1 ]; then - if [ $1 = help ]; then - usage - elif [ $1 = make ]; then - if [ $# -eq 2 ]; then - if [ "$2" = "gnss" ]; then - buildGnssService - elif [ "$2" = "sns" ]; then - buildSensorsService - elif [ "$2" = "enhpos" ]; then - buildEnhancedPositionService - elif [ "$2" = "repl" ]; then - buildLogReplayer - fi - else - buildAll - fi - elif [ $1 = clean ]; then - if [ $# -eq 2 ]; then - if [ "$2" = "gnss" ]; then - rm -rf $GNSS_SERVICE_BIN_DIR - elif [ "$2" = "sns" ]; then - rm -rf $SENSORS_SERVICE_BIN_DIR - elif [ "$2" = "enhpos" ]; then - rm -rf $ENHANCED_POSITION_SERVICE_DBUS_BIN_DIR - rm -rf $ENHANCED_POSITION_SERVICE_FRANCA_BIN_DIR - elif [ "$2" = "repl" ]; then - rm -rf $LOG_REPLAYER_BIN_DIR - fi - else - rm -rf $TOP_BIN_DIR - fi - else - usage - fi -elif [ $# -eq 0 ]; then - #cleanAll - buildAll -else - usage -fi - - diff --git a/enhanced-position-service/CMakeLists.txt b/enhanced-position-service/CMakeLists.txt new file mode 100644 index 0000000..e7035ae --- /dev/null +++ b/enhanced-position-service/CMakeLists.txt @@ -0,0 +1,28 @@ +########################################################################### +# @licence app begin@ +# SPDX-License-Identifier: MPL-2.0 +# +# Component Name: Positioning Top-level Makefile +# +# Author: Jonathan Maw +# +# Copyright (C) 2015, Codethink Ltd +# +# 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/. +# +# Update (2015/05/11) : Jonathan Maw <jonathan.maw@codethink.co.uk> +# - First write +# @licence end@ +########################################################################### +cmake_minimum_required(VERSION 2.6.0) + +if(WITH_DBUS_INTERFACE) + add_subdirectory(dbus) +endif(WITH_DBUS_INTERFACE) + +if(WITH_FRANCA_INTERFACE) + add_subdirectory(franca) +endif(WITH_FRANCA_INTERFACE) diff --git a/enhanced-position-service/dbus/CMakeLists.txt b/enhanced-position-service/dbus/CMakeLists.txt index 0862ad4..c3f8fef 100644 --- a/enhanced-position-service/dbus/CMakeLists.txt +++ b/enhanced-position-service/dbus/CMakeLists.txt @@ -34,9 +34,6 @@ option(WITH_REPLAYER option(WITH_TESTS "Compile test applications" OFF) -option(WITH_DEBUG - "Enable the debug messages" OFF) - message(STATUS) message(STATUS "---------------------------------------------------------") @@ -65,8 +62,9 @@ endif() include_directories(src test ${gnss-service_INCLUDE_DIRS} ${sensors-service_INCLUDE_DIRS}) add_subdirectory(api) -add_subdirectory(src) +message(STATUS "---------------------------------------------------------") +add_subdirectory(src) message(STATUS "---------------------------------------------------------") if(WITH_TESTS) diff --git a/enhanced-position-service/dbus/api/CMakeLists.txt b/enhanced-position-service/dbus/api/CMakeLists.txt index 8763ed1..a191dc6 100644 --- a/enhanced-position-service/dbus/api/CMakeLists.txt +++ b/enhanced-position-service/dbus/api/CMakeLists.txt @@ -23,6 +23,7 @@ find_program(XSLTPROC xsltproc REQUIRED) find_program(DBUSXML2CPP dbusxx-xml2cpp REQUIRED) set(GEN_DIR "${CMAKE_BINARY_DIR}/api") +file(MAKE_DIRECTORY ${GEN_DIR}) message(STATUS "CMAKE_CURRENT_SOURCE_DIR=" ${CMAKE_CURRENT_SOURCE_DIR}) message(STATUS "CMAKE_BINARY_DIR=" "${CMAKE_BINARY_DIR}") @@ -63,11 +64,9 @@ execute_process( OUTPUT_FILE positioning-constants.h ) - - - - - - - - +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/genivi-positioning-enhancedposition.xml + ${CMAKE_CURRENT_SOURCE_DIR}/genivi-positioning-positionfeedback.xml + ${CMAKE_CURRENT_SOURCE_DIR}/genivi-positioning-configuration.xml + ${CMAKE_CURRENT_SOURCE_DIR}/genivi-positioning-constants.xml + DESTINATION share/dbus-1/interfaces +) diff --git a/enhanced-position-service/dbus/src/CMakeLists.txt b/enhanced-position-service/dbus/src/CMakeLists.txt index 8f18022..c1010fc 100644 --- a/enhanced-position-service/dbus/src/CMakeLists.txt +++ b/enhanced-position-service/dbus/src/CMakeLists.txt @@ -79,5 +79,4 @@ message(STATUS "DBUS_CPP_LIBRARIES: " ${DBUS_CPP_LIBRARIES}) message(STATUS "GNSS_SERVICE_LIBRARIES: " ${gnss-service_LIBRARIES}) message(STATUS "SENSORS_SERVICE_LIBRARIES: " ${sensors-service_LIBRARIES}) - - +install(TARGETS enhanced-position-service DESTINATION bin) diff --git a/enhanced-position-service/dbus/test/CMakeLists.txt b/enhanced-position-service/dbus/test/CMakeLists.txt index 0ccc280..62e8009 100644 --- a/enhanced-position-service/dbus/test/CMakeLists.txt +++ b/enhanced-position-service/dbus/test/CMakeLists.txt @@ -61,6 +61,7 @@ target_link_libraries(enhanced-position-client ${LIBRARIES}) message(STATUS "DBUS_CPP_LIBRARIES: " ${DBUS_CPP_LIBRARIES}) +install(TARGETS enhanced-position-client DESTINATION bin) diff --git a/enhanced-position-service/dbus/test/compliance-test/CMakeLists.txt b/enhanced-position-service/dbus/test/compliance-test/CMakeLists.txt index 918e579..9c90c72 100644 --- a/enhanced-position-service/dbus/test/compliance-test/CMakeLists.txt +++ b/enhanced-position-service/dbus/test/compliance-test/CMakeLists.txt @@ -29,7 +29,7 @@ include_directories( ${DBUS_INCLUDEDIR} ${DBUS_INCLUDE_DIRS} ) link_directories ( ${DBUS_LIBDIR} ${DBUS_LIBRARY_DIRS} ) -set(SRCS ${CMAKE_SOURCE_DIR}/test/compliance-test/enhanced-position-service-compliance-test.c) +set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/enhanced-position-service-compliance-test.c) add_executable(enhanced-position-service-compliance-test ${SRCS}) diff --git a/gnss-service/CMakeLists.txt b/gnss-service/CMakeLists.txt index 112194a..04d38e4 100644 --- a/gnss-service/CMakeLists.txt +++ b/gnss-service/CMakeLists.txt @@ -34,27 +34,17 @@ option(WITH_REPLAYER option(WITH_TESTS "Compile test applications" OFF) -option(WITH_DEBUG - "Enable the debug messages" OFF) - SET(CMAKE_INSTALL_RPATH "") #SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) message(STATUS "CMAKE_BINARY_DIR =" ${CMAKE_BINARY_DIR}) -message(STATUS) -message(STATUS "---------------------------------------------------------") - add_subdirectory(src) message(STATUS "---------------------------------------------------------") if(WITH_TESTS) add_subdirectory(test) -message(STATUS "---------------------------------------------------------") - -add_subdirectory(test/compliance-test) - -message(STATUS "---------------------------------------------------------") + message(STATUS "---------------------------------------------------------") + add_subdirectory(test/compliance-test) + message(STATUS "---------------------------------------------------------") endif() - -message(STATUS) diff --git a/gnss-service/src/CMakeLists.txt b/gnss-service/src/CMakeLists.txt index f4c66db..6041444 100644 --- a/gnss-service/src/CMakeLists.txt +++ b/gnss-service/src/CMakeLists.txt @@ -47,18 +47,20 @@ endif() if(WITH_GPSD) pkg_check_modules(GPSD libgps>=2.94) #generate library using gpsd as input - set(LIB_SRC_USE_GPSD ${CMAKE_SOURCE_DIR}/src/gnss-use-gpsd.c - ${CMAKE_SOURCE_DIR}/src/gnss-impl.c - ${CMAKE_SOURCE_DIR}/src/gnss-meta-data.c) + set(LIB_SRC_USE_GPSD ${CMAKE_CURRENT_SOURCE_DIR}/gnss-use-gpsd.c + ${CMAKE_CURRENT_SOURCE_DIR}/gnss-impl.c + ${CMAKE_CURRENT_SOURCE_DIR}/gnss-meta-data.c) add_library(gnss-service-use-gpsd SHARED ${LIB_SRC_USE_GPSD}) target_link_libraries(gnss-service-use-gpsd gps ${LIBRARIES}) + install(TARGETS gnss-service-use-gpsd DESTINATION lib) elseif(WITH_REPLAYER) #generate library using replayer as input - set(LIB_SRC_USE_REPLAYER ${CMAKE_SOURCE_DIR}/src/gnss-use-replayer.c - ${CMAKE_SOURCE_DIR}/src/gnss-impl.c - ${CMAKE_SOURCE_DIR}/src/gnss-meta-data.c) + set(LIB_SRC_USE_REPLAYER ${CMAKE_CURRENT_SOURCE_DIR}/gnss-use-replayer.c + ${CMAKE_CURRENT_SOURCE_DIR}/gnss-impl.c + ${CMAKE_CURRENT_SOURCE_DIR}/gnss-meta-data.c) add_library(gnss-service-use-replayer SHARED ${LIB_SRC_USE_REPLAYER}) target_link_libraries(gnss-service-use-replayer ${LIBRARIES}) + install(TARGETS gnss-service-use-replayer DESTINATION lib) else() message(STATUS "Invalid cmake options!") endif() diff --git a/gnss-service/test/CMakeLists.txt b/gnss-service/test/CMakeLists.txt index 78f87bc..b9e05c2 100755 --- a/gnss-service/test/CMakeLists.txt +++ b/gnss-service/test/CMakeLists.txt @@ -30,7 +30,7 @@ include_directories("${PROJECT_SOURCE_DIR}/src") find_package(PkgConfig) -set(SRCS ${CMAKE_SOURCE_DIR}/test/gnss-service-client.c) +set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/gnss-service-client.c) add_executable(gnss-service-client ${SRCS}) @@ -56,3 +56,4 @@ endif() target_link_libraries(gnss-service-client ${LIBRARIES}) +install(TARGETS gnss-service-client DESTINATION bin) diff --git a/gnss-service/test/compliance-test/CMakeLists.txt b/gnss-service/test/compliance-test/CMakeLists.txt index 416eb75..a1eb104 100644 --- a/gnss-service/test/compliance-test/CMakeLists.txt +++ b/gnss-service/test/compliance-test/CMakeLists.txt @@ -30,7 +30,7 @@ include_directories("${PROJECT_SOURCE_DIR}/src") find_package(PkgConfig) -set(SRCS ${CMAKE_SOURCE_DIR}/test/compliance-test/gnss-service-compliance-test.c) +set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/gnss-service-compliance-test.c) add_executable(gnss-service-compliance-test ${SRCS}) diff --git a/log-replayer/CMakeLists.txt b/log-replayer/CMakeLists.txt index 67621d6..7ef8cdb 100644 --- a/log-replayer/CMakeLists.txt +++ b/log-replayer/CMakeLists.txt @@ -27,19 +27,16 @@ option(WITH_DLT option(WITH_TESTS "Compile test applications" OFF) - -option(WITH_DEBUG - "Enable the debug messages" OFF) -message(STATUS) message(STATUS "---------------------------------------------------------") add_subdirectory(src) +message(STATUS "---------------------------------------------------------") + add_subdirectory(logs) +message(STATUS "---------------------------------------------------------") if(WITH_TESTS) -add_subdirectory(test) + add_subdirectory(test) + message(STATUS "---------------------------------------------------------") endif() - -message(STATUS "---------------------------------------------------------") -message(STATUS) diff --git a/log-replayer/src/CMakeLists.txt b/log-replayer/src/CMakeLists.txt index 7ba2aaf..039ed94 100644 --- a/log-replayer/src/CMakeLists.txt +++ b/log-replayer/src/CMakeLists.txt @@ -22,7 +22,7 @@ message(STATUS "WITH_TESTS = ${WITH_TESTS}") find_package(PkgConfig) -set(LIB_SRCS ${CMAKE_SOURCE_DIR}/src/log-replayer.c) +set(LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/log-replayer.c) set(LIBRARIES pthread) @@ -38,6 +38,8 @@ add_executable(log-replayer ${LIB_SRCS}) target_link_libraries(log-replayer ${LIBRARIES}) +install(TARGETS log-replayer DESTINATION bin) + message(STATUS "---------------------------------------------------------") diff --git a/log-replayer/src/log-replayer.c b/log-replayer/src/log-replayer.c index ab1370a..5063827 100644 --- a/log-replayer/src/log-replayer.c +++ b/log-replayer/src/log-replayer.c @@ -33,7 +33,8 @@ #define BUFLEN 256 #define PORT1 9930 //port used for GNSS data #define PORT2 9931 //port used for sensor data -#define IPADDR "127.0.0.1" +#define PORT3 9932 //port used for vehicle data +#define IPADDR_DEFAULT "127.0.0.1" DLT_DECLARE_CONTEXT(gContext); @@ -119,6 +120,7 @@ int main(int argc, char* argv[]) char * filename = 0; char buf[BUFLEN]; char msgId[MSGIDLEN]; + char * ipaddr = 0; signal(SIGTERM, sighandler); signal(SIGINT, sighandler); @@ -128,8 +130,14 @@ int main(int argc, char* argv[]) LOG_ERROR_MSG(gContext,"missing input parameter: logfile"); return EXIT_FAILURE; } - - filename = argv[1]; + else + { + filename = argv[1]; + if(argc < 3) + ipaddr = IPADDR_DEFAULT; + else + ipaddr = argv[2]; + } DLT_REGISTER_APP("RPLY", "LOG-REPLAYER"); DLT_REGISTER_CONTEXT(gContext,"RSRV", "Global Context"); @@ -147,7 +155,7 @@ int main(int argc, char* argv[]) memset((char *) &si_other, 0, sizeof(si_other)); si_other.sin_family = AF_INET; //si_other.sin_port = htons(<port number>); - if(inet_aton(IPADDR, &si_other.sin_addr) == 0) + if(inet_aton(ipaddr, &si_other.sin_addr) == 0) { LOG_ERROR_MSG(gContext,"inet_aton() failded!"); return EXIT_FAILURE; @@ -213,6 +221,22 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } } + //VHL: list of supported message IDs + char* vhlstr = "GVVEHVER,GVVEHENGSPEED,GVVEHFUELLEVEL,GVVEHFUELCONS,GVVEHTOTALODO"; + if(strstr(vhlstr, msgId) != NULL) + { + LOG_DEBUG(gContext,"Sending Packet to %s:%d",ipaddr,PORT3); + LOG_DEBUG(gContext,"MsgID:%s", msgId); + LOG_DEBUG(gContext,"Len:%d", (int)strlen(buf)); + LOG_DEBUG(gContext,"Data:%s", buf); + + si_other.sin_port = htons(PORT3); + if(sendto(s, buf, strlen(buf)+1, 0, (struct sockaddr *)&si_other, slen) == -1) + { + LOG_ERROR_MSG(gContext,"sendto() failed!"); + return EXIT_FAILURE; + } + } } close(s); diff --git a/log-replayer/test/CMakeLists.txt b/log-replayer/test/CMakeLists.txt index a0cb59c..2097d40 100644 --- a/log-replayer/test/CMakeLists.txt +++ b/log-replayer/test/CMakeLists.txt @@ -27,7 +27,7 @@ include_directories("${PROJECT_SOURCE_DIR}/src") find_package(PkgConfig) -set(SRCS ${CMAKE_SOURCE_DIR}/test/test-log-replayer.c) +set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/test-log-replayer.c) add_executable(test-log-replayer ${SRCS}) set(LIBRARIES pthread) @@ -45,6 +45,7 @@ endif() target_link_libraries(test-log-replayer ${LIBRARIES}) +install(TARGETS test-log-replayer DESTINATION bin) diff --git a/sensors-service/CMakeLists.txt b/sensors-service/CMakeLists.txt index b51fef7..aaa4a13 100644 --- a/sensors-service/CMakeLists.txt +++ b/sensors-service/CMakeLists.txt @@ -37,9 +37,6 @@ option(WITH_IPHONE option(WITH_TESTS "Compile test applications" OFF) -option(WITH_DEBUG - "Enable the debug messages" OFF) - message(STATUS) message(STATUS "---------------------------------------------------------") @@ -47,8 +44,6 @@ add_subdirectory(src) message(STATUS "---------------------------------------------------------") if(WITH_TESTS) -add_subdirectory(test) -message(STATUS "---------------------------------------------------------") + add_subdirectory(test) + message(STATUS "---------------------------------------------------------") endif() - -message(STATUS) diff --git a/sensors-service/src/CMakeLists.txt b/sensors-service/src/CMakeLists.txt index 1abb58d..6df3397 100644 --- a/sensors-service/src/CMakeLists.txt +++ b/sensors-service/src/CMakeLists.txt @@ -46,25 +46,27 @@ endif() if(WITH_IPHONE) #generate library using iphone as input - set(LIB_SRC_USE_IPHONE ${CMAKE_SOURCE_DIR}/src/sns-use-iphone.c - ${CMAKE_SOURCE_DIR}/src/wheeltick.c - ${CMAKE_SOURCE_DIR}/src/gyroscope.c - ${CMAKE_SOURCE_DIR}/src/vehicle-speed.c - ${CMAKE_SOURCE_DIR}/src/sns-meta-data.c) + set(LIB_SRC_USE_IPHONE ${CMAKE_CURRENT_SOURCE_DIR}/sns-use-iphone.c + ${CMAKE_CURRENT_SOURCE_DIR}/wheeltick.c + ${CMAKE_CURRENT_SOURCE_DIR}/gyroscope.c + ${CMAKE_CURRENT_SOURCE_DIR}/vehicle-speed.c + ${CMAKE_CURRENT_SOURCE_DIR}/sns-meta-data.c) add_library(sensors-service-use-iphone SHARED ${LIB_SRC_USE_IPHONE}) target_link_libraries(sensors-service-use-iphone ${LIBRARIES}) + install(TARGETS sensors-service-use-iphone DESTINATION lib) elseif(WITH_REPLAYER) #generate library using replayer as input - set(LIB_SRC_USE_REPLAYER ${CMAKE_SOURCE_DIR}/src/sns-use-replayer.c - ${CMAKE_SOURCE_DIR}/src/wheeltick.c - ${CMAKE_SOURCE_DIR}/src/gyroscope.c - ${CMAKE_SOURCE_DIR}/src/acceleration.c - ${CMAKE_SOURCE_DIR}/src/vehicle-speed.c - ${CMAKE_SOURCE_DIR}/src/sns-meta-data.c) + set(LIB_SRC_USE_REPLAYER ${CMAKE_CURRENT_SOURCE_DIR}/sns-use-replayer.c + ${CMAKE_CURRENT_SOURCE_DIR}/wheeltick.c + ${CMAKE_CURRENT_SOURCE_DIR}/gyroscope.c + ${CMAKE_CURRENT_SOURCE_DIR}/acceleration.c + ${CMAKE_CURRENT_SOURCE_DIR}/vehicle-speed.c + ${CMAKE_CURRENT_SOURCE_DIR}/sns-meta-data.c) add_library(sensors-service-use-replayer SHARED ${LIB_SRC_USE_REPLAYER}) target_link_libraries(sensors-service-use-replayer ${LIBRARIES}) + install(TARGETS sensors-service-use-replayer DESTINATION lib) else() message(STATUS "Invalid cmake options!") endif() diff --git a/sensors-service/test/CMakeLists.txt b/sensors-service/test/CMakeLists.txt index d977016..3569866 100644 --- a/sensors-service/test/CMakeLists.txt +++ b/sensors-service/test/CMakeLists.txt @@ -51,8 +51,10 @@ if(WITH_DEBUG) add_definitions("-DDEBUG_ENABLED=1") endif() -set(SRCS ${CMAKE_SOURCE_DIR}/test/sensors-service-client.c) +set(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/sensors-service-client.c) add_executable(sensors-service-client ${SRCS}) target_link_libraries(sensors-service-client ${LIBRARIES}) +install(TARGETS sensors-service-client DESTINATION bin) + |