summaryrefslogtreecommitdiff
path: root/src/poi-service
diff options
context:
space:
mode:
author <philippe colliot>2015-03-23 18:37:56 +0100
committer <philippe colliot>2015-03-23 18:37:56 +0100
commit07b720bc8ccf25ee6b6b04067f83359475feea8b (patch)
treea847973a1c761583b0c6b030b37872d1df597618 /src/poi-service
parent0d18b1e85db88795675235322d6c500d262410d9 (diff)
downloadpoi-service-07b720bc8ccf25ee6b6b04067f83359475feea8b.tar.gz
Start implementation of poi manager under CommonApi
Diffstat (limited to 'src/poi-service')
-rw-r--r--src/poi-service/poi-manager-server/CMakeLists.txt47
-rw-r--r--src/poi-service/poi-manager-server/main.cpp29
-rw-r--r--src/poi-service/poi-manager-server/poi-manager-server-stub.cpp17
-rw-r--r--src/poi-service/poi-manager-server/poi-manager-server-stub.h23
-rwxr-xr-xsrc/poi-service/script/build.sh12
-rwxr-xr-xsrc/poi-service/script/run11
6 files changed, 136 insertions, 3 deletions
diff --git a/src/poi-service/poi-manager-server/CMakeLists.txt b/src/poi-service/poi-manager-server/CMakeLists.txt
new file mode 100644
index 0000000..79ad5d1
--- /dev/null
+++ b/src/poi-service/poi-manager-server/CMakeLists.txt
@@ -0,0 +1,47 @@
+project(poi-manager-server)
+set(PARENT_API poiservice)
+set(ROOT_API navigation)
+set(COMMON_API_VERSION CommonAPI-2.1)
+
+set(CMAKE_VERBOSE_MAKEFILE off)
+cmake_minimum_required(VERSION 2.8)
+set(CMAKE_CXX_FLAGS "-Wall -O0 -std=c++0x")
+
+# DBus Path
+if (DBUS_LIB_PATH)
+ message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH})
+else()
+ message(FATAL_ERROR "Please specify the path to your patched DBus library using -D DBUS_LIB_PATH=yourPath")
+endif()
+
+# CommonAPI
+find_package(PkgConfig REQUIRED)
+pkg_check_modules (DBUS "dbus-1 >= 1.4")
+pkg_check_modules (COMMONAPI "CommonAPI >= 2.1")
+pkg_check_modules (COMMONAPI_DBUS "CommonAPI-DBus >= 2.1")
+
+# Source Files
+set(PRJ_SRC_PATH .)
+set(PRJ_SRC_GEN_PATH ${COMMON_API_PATH_GENERATED_FILES}/org/genivi)
+FILE(GLOB PRJ_LOCAL_SRCS ${PRJ_SRC_PATH}/*.cpp)
+FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_PATH}/${ROOT_API}/${PARENT_API}/*Stub*.cpp)
+FILE(GLOB PRJ_STUB_GEN_TYPES ${PRJ_SRC_GEN_PATH}/${ROOT_API}/${PARENT_API}/*Types*.cpp ${PRJ_SRC_GEN_PATH}/${ROOT_API}/*Types*.cpp)
+FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_PATH}/*stub*.cpp)
+set(PRJ_SRCS ${PRJ_LOCAL_SRCS} ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_GEN_TYPES} ${PRJ_STUB_IMPL_SRCS})
+
+include_directories(
+ ${COMMON_API_PATH_GENERATED_FILES}
+ ${DBUS_INCLUDE_DIRS}
+ ${COMMONAPI_INCLUDEDIR}/${COMMON_API_VERSION}
+ ${COMMONAPI_DBUS_INCLUDEDIR}
+)
+
+link_directories(
+ ${DBUS_LIB_PATH}
+ ${COMMONAPI_LIBDIR}
+ ${COMMONAPI_DBUS_LIBDIR}
+)
+
+# Build service
+add_executable(${PROJECT_NAME} ${PRJ_SRCS})
+target_link_libraries(${PROJECT_NAME} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES})
diff --git a/src/poi-service/poi-manager-server/main.cpp b/src/poi-service/poi-manager-server/main.cpp
new file mode 100644
index 0000000..12a2762
--- /dev/null
+++ b/src/poi-service/poi-manager-server/main.cpp
@@ -0,0 +1,29 @@
+#include <iostream>
+#include <thread>
+#include <CommonAPI/CommonAPI.h> //Defined in the Common API Runtime library
+#include "poi-manager-server-stub.h"
+
+int main()
+{
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
+ std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
+ std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
+ const std::string& serviceAddress = "local:org.genivi.poiservice.POIContentManager:org.genivi.poiservice.POIContentManager";
+ std::shared_ptr<PoiManagerServerStub> myService = std::make_shared<PoiManagerServerStub>();
+
+ //register Interface for Management of a POI Content Access Module with add/remove features
+ bool registerResult = servicePublisher->registerService(myService, serviceAddress, factory);
+ if (registerResult != true) {
+ std::cerr << "Registering of POI Manager stub failed." << std::endl;
+ exit(1);
+ }
+
+ std::cout << "Welcome to Genivi POI Manager simulation (Server part)" << std::endl << std::endl;
+
+ while(true) {
+ std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
+ std::this_thread::sleep_for(std::chrono::seconds(60));
+ }
+ return 0;
+}
+
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
new file mode 100644
index 0000000..a8fde6b
--- /dev/null
+++ b/src/poi-service/poi-manager-server/poi-manager-server-stub.cpp
@@ -0,0 +1,17 @@
+#include "poi-manager-server-stub.h"
+
+PoiManagerServerStub::PoiManagerServerStub() {
+ m_version.versionMajor = 1;
+ m_version.versionMicro = 0;
+ m_version.versionMinor = 0;
+ m_version.date = "19-12-2012";
+
+}
+
+PoiManagerServerStub::~PoiManagerServerStub() {
+}
+
+void PoiManagerServerStub::getVersion(const std::shared_ptr<CommonAPI::ClientId> clientId, NavigationTypes::Version& version)
+{
+ version = m_version;
+}
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
new file mode 100644
index 0000000..96fe4db
--- /dev/null
+++ b/src/poi-service/poi-manager-server/poi-manager-server-stub.h
@@ -0,0 +1,23 @@
+#ifndef POIMANAGERSERVERSTUBIMPL_H_
+#define POIMANAGERSERVERSTUBIMPL_H_
+
+#include <CommonAPI/CommonAPI.h>
+
+#include "org/genivi/navigation/poiservice/POIContentManagerStubDefault.h"
+
+using namespace org;
+using namespace genivi;
+using namespace navigation;
+using namespace poiservice;
+
+class PoiManagerServerStub: public org::genivi::navigation::poiservice::POIContentManagerStubDefault {
+
+public:
+ PoiManagerServerStub();
+ ~PoiManagerServerStub();
+ void getVersion(const std::shared_ptr<CommonAPI::ClientId> clientId, NavigationTypes::Version& version);
+private:
+ NavigationTypes::Version m_version;
+};
+
+#endif /* POIMANAGERSERVERSTUBIMPL_H_ */
diff --git a/src/poi-service/script/build.sh b/src/poi-service/script/build.sh
index 3fc0f1a..c02195e 100755
--- a/src/poi-service/script/build.sh
+++ b/src/poi-service/script/build.sh
@@ -17,6 +17,7 @@
# @licence end@
###########################################################################
POI_SERVER=poi-server
+POI_MANAGER_SERVER=poi-manager-server
POI_COMMON=poi-common
NAVIGATION_CORE=navigation-core
MAP_VIEWER=map-viewer
@@ -33,6 +34,8 @@ set-path()
POI_SERVER_SRC_DIR=$TOP_DIR/$POI_SERVER
POI_SERVER_BIN_DIR=$TOP_BIN_DIR/$POI_SERVER
+ POI_MANAGER_SERVER_SRC_DIR=$TOP_DIR/$POI_MANAGER_SERVER
+ POI_MANAGER_SERVER_BIN_DIR=$TOP_BIN_DIR/$POI_MANAGER_SERVER
POI_COMMON_SRC_DIR=$TOP_DIR/$POI_COMMON
}
@@ -65,6 +68,15 @@ build() {
mkdir -p $POI_SERVER
cd $POI_SERVER_BIN_DIR
cmake -Dapi_DIR=$API_DIR -Dgenerated_api_DIR=$GENERATED_API_DIR $POI_SERVER_SRC_DIR && make
+
+ echo ''
+ echo 'Building poi-manager-server'
+
+ cd $TOP_BIN_DIR
+ mkdir -p $POI_MANAGER_SERVER
+ cd $POI_MANAGER_SERVER_BIN_DIR
+ cmake -DCOMMON_API_PATH_GENERATED_FILES=../../../api/franca/navigation/src-gen -DDBUS_LIB_PATH=/usr/local/lib $POI_MANAGER_SERVER_SRC_DIR && make
+
}
clean() {
diff --git a/src/poi-service/script/run b/src/poi-service/script/run
index 19aeac1..d646a44 100755
--- a/src/poi-service/script/run
+++ b/src/poi-service/script/run
@@ -29,13 +29,18 @@
echo '------------------------start the server------------------------'
CURDIR=$PWD
ROOT_DIR=$CURDIR/..
-BIN_DIR=$ROOT_DIR/bin/poi-server
-EXE_DIR=$BIN_DIR
+BIN_DIR=$ROOT_DIR/bin
+SERVER_EXE_DIR=$BIN_DIR/poi-server
+MANAGER_SERVER_EXE_DIR=$BIN_DIR/poi-manager-server
MAIN_DATABASE='poi-database-sample.db'
echo 'kill orphan process if necessary'
$CURDIR/kill-all
echo 'run'
-$EXE_DIR/poi-server -f $MAIN_DATABASE &
+$SERVER_EXE_DIR/poi-server -f $MAIN_DATABASE &
+
+echo '------------------------start the manager server------------------------'
+$MANAGER_SERVER_EXE_DIR/poi-manager-server &
+