diff options
author | <philippe colliot> | 2015-08-03 17:28:39 +0200 |
---|---|---|
committer | <philippe colliot> | 2015-08-03 17:28:39 +0200 |
commit | 7408b8e55d16d8fd81acaa4ce08420c34385ee15 (patch) | |
tree | 3037fb3f01301b3cefef902398afcf9fe26594f4 /test/poi-service | |
parent | ac409b558640628fc6f1f6950f21445191806b17 (diff) | |
download | poi-service-7408b8e55d16d8fd81acaa4ce08420c34385ee15.tar.gz |
Clean up of some CMakeLists, remove unnecessary dependencies, create
separate utf based data manager
Diffstat (limited to 'test/poi-service')
-rw-r--r-- | test/poi-service/CMakeLists.txt | 9 | ||||
-rw-r--r-- | test/poi-service/README | 40 | ||||
-rw-r--r-- | test/poi-service/poi-contentaccess-module/CMakeLists.txt | 6 | ||||
-rw-r--r-- | test/poi-service/poi-contentaccess-module/main.cpp | 14 | ||||
-rw-r--r-- | test/poi-service/poi-manager-client/CMakeLists.txt | 4 | ||||
-rw-r--r-- | test/poi-service/poi-supplier/CMakeLists.txt | 2 | ||||
-rw-r--r-- | test/poi-service/poi-supplier/main.cpp | 13 |
7 files changed, 40 insertions, 48 deletions
diff --git a/test/poi-service/CMakeLists.txt b/test/poi-service/CMakeLists.txt index e305580..3911d77 100644 --- a/test/poi-service/CMakeLists.txt +++ b/test/poi-service/CMakeLists.txt @@ -28,10 +28,13 @@ option(WITH_DBUS_INTERFACE "Build using the D-Bus interfaces" ON) option(WITH_DEBUG "Enable the debug messages" OFF) +option(WITH_DATABASE_SUPPLIER + "Build the database supplier" OFF) message(STATUS "WITH_FRANCA_INTERFACE = ${WITH_FRANCA_INTERFACE}") message(STATUS "WITH_DBUS_INTERFACE = ${WITH_DBUS_INTERFACE}") message(STATUS "WITH_DEBUG = ${WITH_DEBUG}") +message(STATUS "WITH_DATABASE_SUPPLIER = ${WITH_DATABASE_SUPPLIER}") set(API_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../api") set(DBUS_GENERATED_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/dbus-include") @@ -54,13 +57,15 @@ add_subdirectory(${API_DIR}/poi-service "${DBUS_GENERATED_INCLUDE_DIR}/poi-servi add_subdirectory(${POI_SRC_DIR}/poi-service "${CMAKE_CURRENT_BINARY_DIR}/poi-service-src") -add_subdirectory(poi-supplier) +if(WITH_DATABASE_SUPPLIER) + add_subdirectory(poi-supplier) +endif() add_subdirectory(poi-client) add_subdirectory(poi-contentaccess-module) -if (WITH_FRANCA_INTERFACE) +if(WITH_FRANCA_INTERFACE) set(FRANCA_DIR "${API_DIR}/franca/navigation") add_subdirectory(poi-manager-client) endif() diff --git a/test/poi-service/README b/test/poi-service/README index 87401f6..64ecdb5 100644 --- a/test/poi-service/README +++ b/test/poi-service/README @@ -1,4 +1,4 @@ -Release date of the file: 02-06-2015 +Release date of the file: 03-08-2015 Status: OK Project: @@ -7,7 +7,7 @@ This project is one of the navigation-service common projects that implements th More: The project is made of four parts: -- poi-supplier that populates a sqlite3 based database from OSM data in xml format +- poi-supplier that populates a sqlite3 based database from OSM data in xml format (you need -DWITH_DATABASE_SUPPLIER=ON) - poi-server that implements the poi search API and access an embedded database - poi-contentaccess-module that implements a content access module that access an additional database, and a simple HMI - poi-client that implements a client with a test HMI @@ -32,9 +32,6 @@ Qt5 (to get the version -> qtchooser -print-env, to set the version -> export QT To get the code: Code is part of the navigation-service repository, so you need to clone all: git clone http://git.projects.genivi.org/lbs/navigation-service.git $WORKING-DIR - -Dependencies: -libqt4-dev libdbus-c++-dev libxml2-dev libsqlite3-dev sqlite3 libglib2.0-dev libglibmm-2.4-dev libdbus-1-dev libxml++2.6-dev xsltproc Important notice before building the POC: # The software is using stream conversion, so please care if your local settings are right @@ -75,6 +72,11 @@ cd .. =============================== How To Prepare the database and the configuration for a country =============================== +NB: You need to build the poi-supplier first: +cd build +cmake -DWITH_DATABASE_SUPPLIER=ON ../ +make + To launch the stuff for Paris: ./prepare -c paris @@ -109,32 +111,24 @@ How To Run ./run =============================== -How To for poi-common-manager-client (experimental) +How To Build poi-common-manager-client (experimental) =============================== -First you need to build the server -cd ../../src/poi-service +First you need to build the poi-manager-server, see the README in ../../src/poi-service + cd build -cmake -DWITH_FRANCA_INTERFACE=ON ../ +cmake -DWITH_FRANCA_INTERFACE=ON -DCOMMONAPI_DBUS_TOOL_GENERATOR=<common-api-dbus-tools folder>/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=<common-api-tools folder>/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86/commonapi-generator-linux-x86 -DWITH_DEBUG=ON ../ make -cd .. -Launch the server + +=============================== +How To Run +=============================== + +Launch the server (into ../../src/poi-service) cp ./resource/poi-database-managed.db ./bin ./bin/poi-manager-server -f ./bin/poi-database-managed.db poi manager server started -Now build the client -cd ../../test/poi-service -cd build -cmake -DWITH_FRANCA_INTERFACE=ON ../ -make -cd ../ Launch the client ./poi-manager-client -t poi manager client started -For the time being, Create category and Delete category worked: - -Category Created -Id: 8 -Categories Removed -Id: 8 diff --git a/test/poi-service/poi-contentaccess-module/CMakeLists.txt b/test/poi-service/poi-contentaccess-module/CMakeLists.txt index d13b32f..ccce535 100644 --- a/test/poi-service/poi-contentaccess-module/CMakeLists.txt +++ b/test/poi-service/poi-contentaccess-module/CMakeLists.txt @@ -29,7 +29,6 @@ find_program(QTRCC rcc REQUIRED) pkg_check_modules(DBUS_CPP dbus-c++-1) pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(SQLITE3 REQUIRED sqlite3) -pkg_check_modules(GLIBMM glibmm-2.4) pkg_check_modules(GOBJECT gobject-2.0) pkg_check_modules(DBUS dbus-1) pkg_check_modules(DBUS_CPP_GLIB dbus-c++-glib-1) @@ -56,7 +55,7 @@ set(qt_release ${QTLRELEASE}) set(qt_rcc ${QTRCC}) #common files shared with poi server -file(GLOB PRJ_COMMON_SRCS ${COMMON_DIR_POI_SERVER}/*.cpp) +file(GLOB PRJ_COMMON_SRCS ${COMMON_DIR_POI_SERVER}/poi-common-database.cpp) # for some reason, automoc doesn't run, so moc is made manually file(GLOB SRC_TO_MOC ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h @@ -149,7 +148,6 @@ include_directories( ${DBUS_CPP_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIRS} - ${GLIBMM_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS} ${DBUS_CPP_GLIB_INCLUDE_DIRS} @@ -164,7 +162,6 @@ link_directories( ${DBUS_CPP_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${SQLITE3_LIBRARY_DIRS} - ${GLIBMM_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS} ${DBUS_LIBRARY_DIRS} ${DBUS_CPP_GLIB_DIRS} @@ -187,7 +184,6 @@ set(LIBRARIES ${DBUS_CPP_LIBRARIES} ${GLIB_LIBRARIES} ${SQLITE3_LIBRARIES} - ${GLIBMM_LIBRARIES} ${GOBJECT_LIBRARIES} ${DBUS_LIBRARIES} ${DBUS_CPP_GLIB_LIBRARIES} diff --git a/test/poi-service/poi-contentaccess-module/main.cpp b/test/poi-service/poi-contentaccess-module/main.cpp index 6d946c0..1dc7245 100644 --- a/test/poi-service/poi-contentaccess-module/main.cpp +++ b/test/poi-service/poi-contentaccess-module/main.cpp @@ -121,7 +121,7 @@ contentAccessModuleServer::contentAccessModuleServer(DBus::Connection &connectio // so we can update some tables into the constructor // retrieve the available categories (the ones that have at least one record) - query_result = mp_database->queryNotUTF(SQL_REQUEST_GET_AVAILABLE_CATEGORIES); + query_result = mp_database->query(SQL_REQUEST_GET_AVAILABLE_CATEGORIES); if (query_result.empty()) { onError(); //database is not well populated @@ -143,7 +143,7 @@ contentAccessModuleServer::contentAccessModuleServer(DBus::Connection &connectio strStream << value; sqlQuery += strStream.str(); sqlQuery += ");"; - additionnal_query_result = mp_database->queryNotUTF(sqlQuery.c_str()); + additionnal_query_result = mp_database->query(sqlQuery.c_str()); if (additionnal_query_result.empty()) { onError(); //database is not well populated @@ -163,7 +163,7 @@ contentAccessModuleServer::contentAccessModuleServer(DBus::Connection &connectio strStream << m_availableCategoryTable[index].id; sqlQuery += strStream.str(); sqlQuery += ");"; - additionnal_query_result = mp_database->queryNotUTF(sqlQuery.c_str()); + additionnal_query_result = mp_database->query(sqlQuery.c_str()); if (additionnal_query_result.empty()) { onError(); //database is not well populated @@ -194,7 +194,7 @@ contentAccessModuleServer::contentAccessModuleServer(DBus::Connection &connectio strStream << m_availableCategoryTable[index].id; sqlQuery += strStream.str(); sqlQuery += ";"; - query_result = mp_database->queryNotUTF(sqlQuery.c_str()); + query_result = mp_database->query(sqlQuery.c_str()); if (query_result.empty()) { onError(); //database is not well populated @@ -221,7 +221,7 @@ contentAccessModuleServer::contentAccessModuleServer(DBus::Connection &connectio strStream << m_availableCategoryTable[index].id; sqlQuery += strStream.str(); sqlQuery += ";"; - query_result = mp_database->queryNotUTF(sqlQuery.c_str()); + query_result = mp_database->query(sqlQuery.c_str()); if (query_result.empty()) { //no child @@ -238,7 +238,7 @@ contentAccessModuleServer::contentAccessModuleServer(DBus::Connection &connectio } //retrieve the available area into the database - query_result = mp_database->queryNotUTF(SQL_REQUEST_GET_AVAILABLE_AREA); + query_result = mp_database->query(SQL_REQUEST_GET_AVAILABLE_AREA); if (query_result.empty()) { onError(); //database is not well populated @@ -612,7 +612,7 @@ uint16_t contentAccessModuleServer::searchPOIRequest(uint16_t categoryIndex, std sqlQuery += ")) AND (name LIKE '%"; sqlQuery += search_string; sqlQuery += "%');"; - sqlQueryResult = mp_database->queryNotUTF(sqlQuery.c_str()); + sqlQueryResult = mp_database->query(sqlQuery.c_str()); //populate the tables of poi poi.category = categoryIndex; //category diff --git a/test/poi-service/poi-manager-client/CMakeLists.txt b/test/poi-service/poi-manager-client/CMakeLists.txt index edaa40c..e85f635 100644 --- a/test/poi-service/poi-manager-client/CMakeLists.txt +++ b/test/poi-service/poi-manager-client/CMakeLists.txt @@ -47,7 +47,6 @@ pkg_check_modules(DBUS "dbus-1 >= 1.4") pkg_check_modules(COMMONAPI "CommonAPI >= 3.1") pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1") pkg_check_modules(SQLITE3 REQUIRED sqlite3) -pkg_check_modules(GLIBMM glibmm-2.4) pkg_check_modules(GOBJECT gobject-2.0) pkg_check_modules(GLIB REQUIRED glib-2.0) @@ -69,7 +68,6 @@ include_directories( ${DBUS_INCLUDE_DIRS} ${COMMONAPI_INCLUDE_DIRS} ${COMMONAPI_DBUS_INCLUDE_DIRS} - ${GLIBMM_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIRS} @@ -82,7 +80,6 @@ link_directories( ${DBUS_LIB_PATH} ${COMMONAPI_LIBDIR} ${COMMONAPI_DBUS_LIBDIR} - ${GLIBMM_LIBRARY_DIRS} ${GOBJECT_LIBRARY_DIRS} ${SQLITE3_LIBRARY_DIRS} @@ -94,7 +91,6 @@ set(LIBRARIES ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} ${GOBJECT_LIBRARIES} - ${GLIBMM_LIBRARIES} ${SQLITE3_LIBRARIES} ${GLIB_LIBRARIES} diff --git a/test/poi-service/poi-supplier/CMakeLists.txt b/test/poi-service/poi-supplier/CMakeLists.txt index e262edf..4a0cbc0 100644 --- a/test/poi-service/poi-supplier/CMakeLists.txt +++ b/test/poi-service/poi-supplier/CMakeLists.txt @@ -30,7 +30,7 @@ pkg_check_modules(XML2 libxml-2.0) pkg_check_modules(XMLCPP libxml++-2.6) #common files shared with poi server -file(GLOB PRJ_COMMON_SRCS ${COMMON_DIR_POI_SERVER}/*.cpp) +file(GLOB PRJ_COMMON_SRCS ${COMMON_DIR_POI_SERVER}/poi-common-database-utf.cpp) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/test/poi-service/poi-supplier/main.cpp b/test/poi-service/poi-supplier/main.cpp index 2697163..4762cfc 100644 --- a/test/poi-service/poi-supplier/main.cpp +++ b/test/poi-service/poi-supplier/main.cpp @@ -28,12 +28,13 @@ #include <getopt.h> -#include "poi-common-database.h" +#include "poi-common-database-utf.h" #include "poi-datamodel.h" #include "raw-file-sort.h" + #ifndef SAFE_DELETE #define SAFE_DELETE(_p) { if ((_p) != NULL) { delete(_p); (_p) = NULL; } } #endif @@ -98,7 +99,7 @@ int main(int argc , char** argv ) std::string *sort_list; //list of secondary keys (set as parameters) uint8_t sort_list_size; //number of secondary keys - Database *sqlDatabase; //sqlite3 database + DatabaseUTF *sqlDatabase; //sqlite3 database Glib::ustring sqlQuery; //SQL request on database vector<vector<Glib::ustring> > sqlQueryResult; //result of the query on database vector<Glib::ustring> sqlQueryLine; @@ -144,21 +145,21 @@ int main(int argc , char** argv ) case 'a': /* -a --add_scheme database scheme */ database_filename = argv[2]; scheme_filename = argv[3]; - sqlDatabase = new Database(database_filename); + sqlDatabase = new DatabaseUTF(database_filename); sqlDatabase->add(scheme_filename); sqlDatabase->close(); delete sqlDatabase; break; case 'v': /* -v --view database */ database_filename = argv[2]; - sqlDatabase = new Database(database_filename); + sqlDatabase = new DatabaseUTF(database_filename); sqlDatabase->schema(); sqlDatabase->close(); delete sqlDatabase; break; case 's': /* -s --select database */ database_filename = argv[2]; - sqlDatabase = new Database(database_filename); + sqlDatabase = new DatabaseUTF(database_filename); sqlQueryResult = sqlDatabase->query(SQL_POI_TABLE_SELECT); for(vector<vector<Glib::ustring> >::iterator it = sqlQueryResult.begin(); it < sqlQueryResult.end(); ++it) { @@ -217,7 +218,7 @@ int main(int argc , char** argv ) xml_parser(xml_filename, sort_primary_key, sort_list, sort_list_size, poi_buffer, &poi_buffer_index); // database update database_filename = argv[2]; - sqlDatabase = new Database(database_filename); + sqlDatabase = new DatabaseUTF(database_filename); //get id sqlQueryResult = sqlDatabase->query(SQL_POI_MAX_ID); sqlQueryLine = sqlQueryResult.at(0); |