diff options
author | asanoaozora <fifitaneki@hotmail.com> | 2016-06-21 14:43:16 +0200 |
---|---|---|
committer | asanoaozora <fifitaneki@hotmail.com> | 2016-06-21 14:43:16 +0200 |
commit | 9bbc028781d58dbfd29bb77cf6e1892307964d35 (patch) | |
tree | a13ecafae920db4fe7876004f2bd24fb3379cbe7 /src | |
parent | afd74c2978de340727b7890027acbe855def5821 (diff) | |
download | poi-service-9bbc028781d58dbfd29bb77cf6e1892307964d35.tar.gz |
poi add/remove POC migrated and tested
Diffstat (limited to 'src')
-rw-r--r-- | src/poi-service/poi-manager-server/CMakeLists.txt | 46 | ||||
-rw-r--r-- | src/poi-service/poi-manager-server/README.md | 15 | ||||
-rw-r--r-- | src/poi-service/poi-manager-server/main.cpp | 10 | ||||
-rw-r--r-- | src/poi-service/poi-manager-server/poi-manager-server-stub.cpp | 2 | ||||
-rw-r--r-- | src/poi-service/poi-manager-server/poi-manager-server-stub.h | 10 | ||||
-rwxr-xr-x | src/poi-service/poi-manager-server/run.sh | 6 | ||||
-rw-r--r-- | src/poi-service/resource/commonapi-dbus.ini | 9 | ||||
-rw-r--r-- | src/poi-service/resource/commonapi4dbus.ini | 4 |
8 files changed, 53 insertions, 49 deletions
diff --git a/src/poi-service/poi-manager-server/CMakeLists.txt b/src/poi-service/poi-manager-server/CMakeLists.txt index cb00ca8..2ea667b 100644 --- a/src/poi-service/poi-manager-server/CMakeLists.txt +++ b/src/poi-service/poi-manager-server/CMakeLists.txt @@ -20,20 +20,9 @@ cmake_minimum_required(VERSION 2.8) message(STATUS ${PROJECT_NAME}) -option(DBUS_LIB_PATH - "Path to the patched DBus library") - set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_CXX_FLAGS "-Wall -std=c++0x") -set(PARENT_API poiservice) -set(ROOT_API navigation) -set(API_VERSION_MAJOR 4) -set(API_VERSION "v${API_VERSION_MAJOR}") -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}/${API_VERSION}/org/genivi/${ROOT_API}) -set(PRJ_SRC_GEN_POISERVICE_TYPES_PATH ${COMMONAPI_GEN_DIR}/${API_VERSION}/org/genivi/${ROOT_API}/${PARENT_API}) set(API_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../api") set(FRANCA_DIR "${API_DIR}/franca") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) @@ -47,7 +36,7 @@ if(DBUS_LIB_PATH) set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib) set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so) else() - message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath") + message(FATAL_ERROR "Please specify the path to your patched DBus library using -DDBUS_LIB_PATH=yourPath") endif() # Packages @@ -62,21 +51,40 @@ pkg_check_modules(SQLITE3 REQUIRED sqlite3) pkg_check_modules(GOBJECT gobject-2.0) pkg_check_modules(GLIB REQUIRED glib-2.0) +# Add the Franca files (that will generate the CommonAPI stuff) +set(COMMONAPI_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/src-gen") +add_subdirectory(${FRANCA_DIR}/navigation/poiservice "${CMAKE_CURRENT_BINARY_DIR}/franca") + +# Path to the generated files +set(API_VERSION_MAJOR 4) +set(API_VERSION "v${API_VERSION_MAJOR}") +set(PRJ_SRC_GEN_ROOT_PATH ${COMMONAPI_GEN_DIR}/${API_VERSION}/org/genivi) #files shared by all the APIs +set(PRJ_SRC_GEN_NAVIGATION_PATH ${PRJ_SRC_GEN_ROOT_PATH}/navigation) #files shared by the navigation APIs +set(PRJ_SRC_GEN_POISERVICE_PATH ${PRJ_SRC_GEN_NAVIGATION_PATH}/poiservice) #files shared by the poiservice APIs + # Source Files FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) FILE(GLOB PRJ_COMMON_SRCS ${COMMON_DIR}/poi-common-database.cpp ${COMMON_DIR}/poi-common-math.cpp) +FILE(GLOB PRJ_STUB_GEN_SRCS + ${PRJ_SRC_GEN_ROOT_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*Types.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_ROOT_PATH}/*StubDefault.cpp + ${PRJ_SRC_GEN_NAVIGATION_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_NAVIGATION_PATH}/*Types.cpp ${PRJ_SRC_GEN_NAVIGATION_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_NAVIGATION_PATH}/*StubDefault.cpp + ${PRJ_SRC_GEN_POISERVICE_PATH}/*DBusStub*.cpp ${PRJ_SRC_GEN_POISERVICE_PATH}/*Types.cpp ${PRJ_SRC_GEN_POISERVICE_PATH}/*DBusDeployment.cpp ${PRJ_SRC_GEN_POISERVICE_PATH}/*StubDefault.cpp + ) +FILE(GLOB PRJ_STUB_IMPL_SRCS + ${PRJ_SRC_GEN_ROOT_PATH}/*Stub*.cpp + ${PRJ_SRC_GEN_NAVIGATION_PATH}/*Stub*.cpp + ${PRJ_SRC_GEN_POISERVICE_PATH}/*Stub*.cpp + ) -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) -set(PRJ_SRCS ${PRJ_LOCAL_SRCS} ${PRJ_COMMON_SRCS} ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_GEN_TYPES}) +set(PRJ_SRCS ${PRJ_LOCAL_SRCS} ${PRJ_COMMON_SRCS} ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) include_directories( ${COMMON_DIR} - ${PRJ_SRC_GEN_PATH} - ${DBUS_INCLUDE_DIRS} ${COMMONAPI_GEN_DIR} + ${PRJ_SRC_GEN_ROOT_PATH} + ${PRJ_SRC_GEN_NAVIGATION_PATH} + ${PRJ_SRC_GEN_POISERVICE_PATH} + ${DBUS_INCLUDE_DIRS} ${COMMONAPI_INCLUDE_DIRS} ${COMMONAPI_DBUS_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} diff --git a/src/poi-service/poi-manager-server/README.md b/src/poi-service/poi-manager-server/README.md index b35ee26..df99baa 100644 --- a/src/poi-service/poi-manager-server/README.md +++ b/src/poi-service/poi-manager-server/README.md @@ -27,20 +27,7 @@ or to build updated parts ```./build.sh``` ## How To Run -First it's required to set a config file: -Copy the configuration file ../resource/commonapi-dbus.ini in a directory of your choice - -Set the environment variable COMMONAPI_DBUS_DEFAULT_CONFIG before starting the poi-manager-server. - -Example: -```export COMMONAPI_DBUS_DEFAULT_CONFIG=<your path>/commonapi-dbus.ini``` - -Copy the database for testing: - -```cp ../resource/poi-database-managed.db ./bin``` - -And launch the server (use d-feet to check if it's running or build the client) -```./bin/poi-manager-server -f ./bin/poi-database-managed.db``` +```./run.sh``` ## License diff --git a/src/poi-service/poi-manager-server/main.cpp b/src/poi-service/poi-manager-server/main.cpp index 53b3ceb..6a3ec74 100644 --- a/src/poi-service/poi-manager-server/main.cpp +++ b/src/poi-service/poi-manager-server/main.cpp @@ -82,17 +82,15 @@ int main(int argc , char** argv ) // Common API data init std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); - const std::string &domain = "local"; - const std::string &instance = "POIContentManager"; - - std::string connection = "POIContentManager"; + const std::string domain = "local"; + const std::string instance = "POIContentAccessModuleService"; std::shared_ptr<PoiManagerServerStub> myServicePOIContentManager = std::make_shared<PoiManagerServerStub>(); - bool successfullyRegistered = runtime->registerService(domain, instance, myServicePOIContentManager, connection); + bool successfullyRegistered = runtime->registerService(domain, instance, myServicePOIContentManager); while (!successfullyRegistered) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); - successfullyRegistered = runtime->registerService(domain, instance, myServicePOIContentManager, connection); + successfullyRegistered = runtime->registerService(domain, instance, myServicePOIContentManager); } //index used for argument analysis 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 a4cfb39..2beec13 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 @@ -1396,7 +1396,7 @@ void PoiManagerServerStub::removePOIs(const std::shared_ptr<CommonAPI::ClientId> } } -void PoiManagerServerStub::poiSearchStarted(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationTypes::Handle _poiSearchHandle, uint16_t _maxSize, NavigationTypes::Coordinate3D _location, std::vector< POIServiceTypes::CategoryAndRadius> _poiCategories, std::vector< POIServiceTypes::AttributeDetails> _poiAttributes, std::string _inputString, int32_t _sortOption, poiSearchStartedReply_t _reply) +void PoiManagerServerStub::poiSearchStarted(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationTypes::Handle _poiSearchHandle, uint16_t _maxSize, NavigationTypes::Coordinate3D _location, std::vector< POIServiceTypes::CategoryAndRadius> _poiCategories, std::vector< POIServiceTypes::AttributeDetails> _poiAttributes, std::string _inputString, POIServiceTypes::SortOption _sortOption, poiSearchStartedReply_t _reply) { POIServiceTypes::CategoryAndRadius categoryAndRadius; size_t index; 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 1d3961b..c34d265 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,10 +29,10 @@ #include <CommonAPI/CommonAPI.hpp> -#include <v4/org/genivi/CommonTypes.hpp> -#include <v4/org/genivi/navigation/NavigationTypes.hpp> -#include <v4/org/genivi/navigation/poiservice/POIServiceTypes.hpp> -#include <v4/org/genivi/navigation/poiservice/POIContentAccessModuleStubDefault.hpp> +#include <CommonTypes.hpp> +#include <NavigationTypes.hpp> +#include <POIServiceTypes.hpp> +#include <POIContentAccessModuleStubDefault.hpp> #include "poi-common-database.h" @@ -203,7 +203,7 @@ public: void removeCategories(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector< CommonTypes::CategoryID> _categories, removeCategoriesReply_t _reply); void addPOIs(const std::shared_ptr<CommonAPI::ClientId> _client, CommonTypes::CategoryID _unique_id, std::vector< POIServiceTypes::PoiAddedDetails> _poiList, addPOIsReply_t _reply); void removePOIs(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector< POIServiceTypes::POI_ID> _ids, removePOIsReply_t _reply); - void poiSearchStarted(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationTypes::Handle _poiSearchHandle, uint16_t _maxSize, NavigationTypes::Coordinate3D _location, std::vector< POIServiceTypes::CategoryAndRadius> _poiCategories, std::vector< POIServiceTypes::AttributeDetails> _poiAttributes, std::string _inputString, int32_t _sortOption, poiSearchStartedReply_t _reply); + void poiSearchStarted(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationTypes::Handle _poiSearchHandle, uint16_t _maxSize, NavigationTypes::Coordinate3D _location, std::vector< POIServiceTypes::CategoryAndRadius> _poiCategories, std::vector< POIServiceTypes::AttributeDetails> _poiAttributes, std::string _inputString, POIServiceTypes::SortOption _sortOption, poiSearchStartedReply_t _reply); void poiSearchCanceled(const std::shared_ptr<CommonAPI::ClientId> _client, NavigationTypes::Handle _poiSearchHandle, poiSearchCanceledReply_t _reply); void resultListRequested(const std::shared_ptr<CommonAPI::ClientId> _client, POIServiceTypes::ContentAccessModuleID _camId, NavigationTypes::Handle _poiSearchHandle, std::vector< POIServiceTypes::AttributeID> _attributes, resultListRequestedReply_t _reply); void poiDetailsRequested(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector< POIServiceTypes::POI_ID> _source_id, poiDetailsRequestedReply_t _reply); diff --git a/src/poi-service/poi-manager-server/run.sh b/src/poi-service/poi-manager-server/run.sh new file mode 100755 index 0000000..eb6337a --- /dev/null +++ b/src/poi-service/poi-manager-server/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash +RESOURCE=../resource +cp $RESOURCE/poi-database-managed.db ./bin +COMMONAPI_DEFAULT_CONFIG=$RESOURCE/commonapi4dbus.ini \ +COMMONAPI_DBUS_DEFAULT_CONFIG=$RESOURCE/commonapi-dbus.ini \ +./bin/poi-manager-server -f ./bin/poi-database-managed.db & diff --git a/src/poi-service/resource/commonapi-dbus.ini b/src/poi-service/resource/commonapi-dbus.ini index 4cddb07..2c56b8e 100644 --- a/src/poi-service/resource/commonapi-dbus.ini +++ b/src/poi-service/resource/commonapi-dbus.ini @@ -1,4 +1,5 @@ -[local:org.genivi.poiservice.POIContentManager:org.genivi.poiservice.POIContentManager] -service=org.genivi.poiservice.POIContentManager -path=/org/genivi/poiservice/POIContentManager -interface=org.genivi.poiservice.POIContentManager +[local:org.genivi.navigation.poiservice.POIContentAccessModule:POIContentAccessModuleService] +service=org.genivi.navigation.poiservice +path=/org/genivi/navigation/poiservice/POIContentAccessModule +interface=org.genivi.navigation.poiservice.POIContentAccessModule + diff --git a/src/poi-service/resource/commonapi4dbus.ini b/src/poi-service/resource/commonapi4dbus.ini new file mode 100644 index 0000000..1e5b30b --- /dev/null +++ b/src/poi-service/resource/commonapi4dbus.ini @@ -0,0 +1,4 @@ +[default] +binding=dbus + + |