summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author <philippe colliot>2015-08-03 17:28:39 +0200
committer <philippe colliot>2015-08-03 17:28:39 +0200
commit7408b8e55d16d8fd81acaa4ce08420c34385ee15 (patch)
tree3037fb3f01301b3cefef902398afcf9fe26594f4 /src
parentac409b558640628fc6f1f6950f21445191806b17 (diff)
downloadpoi-service-7408b8e55d16d8fd81acaa4ce08420c34385ee15.tar.gz
Clean up of some CMakeLists, remove unnecessary dependencies, create
separate utf based data manager
Diffstat (limited to 'src')
-rw-r--r--src/poi-service/README38
-rw-r--r--src/poi-service/poi-common/poi-common-database-utf.cpp259
-rw-r--r--src/poi-service/poi-common/poi-common-database-utf.h59
-rw-r--r--src/poi-service/poi-common/poi-common-database.cpp58
-rw-r--r--src/poi-service/poi-common/poi-common-database.h10
-rw-r--r--src/poi-service/poi-manager-server/CMakeLists.txt12
-rw-r--r--src/poi-service/poi-manager-server/main.cpp1
-rw-r--r--src/poi-service/poi-manager-server/poi-manager-server-stub.cpp74
-rw-r--r--src/poi-service/poi-server/CMakeLists.txt6
-rw-r--r--src/poi-service/poi-server/main.cpp14
-rwxr-xr-xsrc/poi-service/run48
11 files changed, 402 insertions, 177 deletions
diff --git a/src/poi-service/README b/src/poi-service/README
index fdd3a15..f1536ea 100644
--- a/src/poi-service/README
+++ b/src/poi-service/README
@@ -1,4 +1,4 @@
-Release date of the file: 18-09-2014
+Release date of the file: 03-08-2015
Status: OK
Project:
@@ -6,15 +6,16 @@ Search engine for Point Of Interest with a content access module mechanism to ex
This project is one of the navigation-service common projects that implements the GENIVI navigation APIs.
More:
-The project is made of four parts:
+The project is made of sub parts:
- poi-supplier that populates a sqlite3 based database from OSM data in xml format
- 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
+- poi-manager-server and poi-manager-client that implements a CommonAPI based proof of concept of an extension of the poi-contentaccess-module
See also other navigation projects like navigation or proof of concepts implemented for traffic-info and positioning
What is in:
-This folder contains scripts for building poi-server
+This folder contains scripts for building poi-server and poi-manager-server
FYI: poi-supplier, poi-contentaccess-module and poi-client are located under test/poi-service
Author:
@@ -27,14 +28,11 @@ Test target:
Ubuntu 14.04 LTS
To get the code:
-Code is part of the navigation-service repository, so you need to clone all:
+Code is part of the navigation-service repository, so you need to clone the whole content:
git clone http://git.projects.genivi.org/lbs/navigation-service.git $WORKING-DIR
-
-Dependencies:
-libqt4-dev libdbus-c++-dev libsqlite3-dev sqlite3 libglib2.0-dev libglibmm-2.4-dev libdbus-1-dev xsltproc
===============================
-How To Build
+How To Build poi-server
===============================
Create and enter the build folder:
@@ -46,17 +44,25 @@ cmake ../
make
cd ..
-Build the Franca based code (unreleased version) in debug mode
-cmake -DCMAKE_BUILD_TYPE=Debug . -DWITH_FRANCA_INTERFACE=ON ../
-make
-cd ..
+===============================
+How To Run poi-server
+===============================
+
+./bin/poi-server -f ./resource/poi-database-sample.db
===============================
-How To Run
+How To Build poi-manager-server
===============================
+NB: You need CommonAPI 3.1.2 and Franca 0.9.1 installed
-./run
+cd build
+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 ..
+===============================
+How To Run poi-manager-server
+===============================
Copy the configuration file commonapi-dbus.ini in a directory of your choice
@@ -65,3 +71,7 @@ Set the environment variable COMMONAPI_DBUS_DEFAULT_CONFIG before starting the E
Example:
export COMMONAPI_DBUS_DEFAULT_CONFIG=<your path>/commonapi-dbus.ini
+cp ./resource/poi-database-managed.db ./bin
+./bin/poi-manager-server -f ./bin/poi-database-managed.db
+
+
diff --git a/src/poi-service/poi-common/poi-common-database-utf.cpp b/src/poi-service/poi-common/poi-common-database-utf.cpp
new file mode 100644
index 0000000..c09c634
--- /dev/null
+++ b/src/poi-service/poi-common/poi-common-database-utf.cpp
@@ -0,0 +1,259 @@
+/**
+* @licence app begin@
+* SPDX-License-Identifier: MPL-2.0
+*
+* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
+*
+* \file poi-common-database-utf.cpp
+*
+* \brief This file is part of the poi proof of concept.
+*
+* \author Philippe Colliot <philippe.colliot@mpsa.com>
+*
+* \version 1.1
+*
+* This Source Code Form is subject to the terms of the
+* Mozilla Public License (MPL), 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/.
+*
+* For further information see http://www.genivi.org/.
+*
+* List of changes:
+* 10-02-2014, Philippe Colliot, refinement and migration to the new repository
+* <date>, <name>, <description of change>
+*
+* @licence end@
+*/
+#include "poi-common-database-utf.h"
+#include <stdio.h>
+#include <iostream>
+
+/**
+ * \fn Database(const char* filename)
+ * \brief Constructor.
+ *
+ * \param const char* filename -name of the database file to open
+ * \return void.
+ */
+DatabaseUTF::DatabaseUTF(const char* filename)
+{
+ database = NULL;
+ open(filename); //no check for valid file
+ m_filename = filename;
+}
+
+/**
+ * \fn ~Database()
+ * \brief Destructor.
+ *
+ * \param
+ * \return void.
+ */
+DatabaseUTF::~DatabaseUTF()
+{
+}
+
+/**
+ * \fn open(const char* filename)
+ * \brief Open the database.
+ *
+ * \param const char* filename -name of the database file to open
+ * \return bool. -true if database consistant
+ */
+bool DatabaseUTF::open(const char* filename)
+{
+ if(sqlite3_open(filename, &database) == SQLITE_OK)
+ return true;
+
+ return false;
+}
+
+/**
+ * \fn schema()
+ * \brief Get the scheme of the database.
+ *
+ * \param
+ * \return bool. -true if SQL command succeed
+ */
+bool DatabaseUTF::schema()
+{
+ FILE *fpipe;
+ std::string command = "";
+ command += "sqlite3 ";
+ command += m_filename;
+ command += " \"";
+ command += ".schema";
+ command += "\"";
+
+ char line[256];
+
+ if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) )
+ { // If fpipe is NULL
+ perror("Problems with pipe");
+ return false;
+ }
+
+ while ( fgets( line, sizeof line, fpipe))
+ {
+ printf("%s", line);
+ }
+ pclose(fpipe);
+
+ return true;
+}
+
+/**
+ * \fn add(const char* scheme_filename)
+ * \brief Add a scheme to the database.
+ *
+ * \param const char* scheme_filename -filename that contains the scheme
+ * \return bool. -true if SQL command succeed
+ */
+bool DatabaseUTF::add(const char* scheme_filename)
+{
+ FILE *fpipe;
+ std::string command = "";
+ command += "sqlite3 ";
+ command += m_filename;
+ command = command + " < " + scheme_filename;
+
+ char line[256];
+
+ if ( !(fpipe = (FILE*)popen(command.c_str(),"r")) )
+ { // If fpipe is NULL
+ perror("Problems with pipe");
+ return false;
+ }
+
+ while ( fgets( line, sizeof line, fpipe))
+ {
+ printf("%s", line);
+ }
+ pclose(fpipe);
+
+ return true;
+}
+
+/**
+ * \fn beginTransaction()
+ * \brief Begin a SQL transaction.
+ *
+ * \param
+ * \return void
+ */
+void DatabaseUTF::beginTransaction()
+{
+ char* errorMessage;
+ sqlite3_exec(database, "BEGIN TRANSACTION;", NULL, NULL, &errorMessage);
+}
+
+/**
+ * \fn appendTransaction(const char* query)
+ * \brief Append a SQL request.
+ *
+ * \param const char* query -SQL request
+ * \return void
+ */
+void DatabaseUTF::appendTransaction(const char* query)
+{
+ sqlite3_exec(database, query, NULL, NULL, NULL);
+}
+
+/**
+ * \fn commitTransaction()
+ * \brief Commit a SQL transaction.
+ *
+ * \param
+ * \return void
+ */
+void DatabaseUTF::commitTransaction()
+{
+ char* errorMessage;
+ sqlite3_exec(database, "COMMIT;", NULL, NULL, &errorMessage);
+}
+
+/**
+ * \fn query(const char* query)
+ * \brief Query a SQL request.
+ *
+ * \param const char* query -SQL request
+ * \return vector<vector<Glib::ustring> > -Result of the query
+ */
+vector<vector<Glib::ustring> > DatabaseUTF::query(const char* query)
+{
+ sqlite3_stmt *statement;
+ vector<vector<Glib::ustring> > results;
+
+ if(sqlite3_prepare_v2(database, query, -1, &statement, 0) == SQLITE_OK)
+ {
+ int cols = sqlite3_column_count(statement);
+ int result = 0;
+ while(true)
+ {
+ result = sqlite3_step(statement);
+
+ if(result == SQLITE_ROW)
+ {
+ vector<Glib::ustring> values;
+ for(int col = 0; col < cols; col++)
+ {
+ Glib::ustring val;
+ char * ptr = (char*)sqlite3_column_text(statement, col);
+ if(ptr)
+ {
+ val = ptr;
+ }
+ else val = ""; // this can be commented out since std::string val;
+ values.push_back(val); // now we will never push NULL
+ }
+ results.push_back(values);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ sqlite3_finalize(statement);
+ }
+
+ string error = sqlite3_errmsg(database);
+ if(error != "not an error") cout << query << " " << error << endl;
+ return results;
+}
+
+/**
+ * \fn close()
+ * \brief Close the database.
+ *
+ * \param
+ * \return void
+ */
+void DatabaseUTF::close()
+{
+ sqlite3_close(database);
+}
+
+/**
+ * \fn callback(void *NotUsed, int argc, char **argv, char **azColName)
+ * \brief Call back function for database access.
+ *
+ * \param void *NotUsed
+ * \param int argc
+ * \param char **argv
+ * \param char **azColName
+ * \return int
+ */
+int DatabaseUTF::callback(void *NotUsed, int argc, char **argv, char **azColName)
+{
+ NotUsed=0;
+ int i;
+ for(i=0; i<argc; i++){
+ printf("%s = %s\n", azColName[i], argv[i] ? argv[i]: "NULL");
+ }
+ printf("\n");
+ return 0;
+}
+
+
diff --git a/src/poi-service/poi-common/poi-common-database-utf.h b/src/poi-service/poi-common/poi-common-database-utf.h
new file mode 100644
index 0000000..613bf03
--- /dev/null
+++ b/src/poi-service/poi-common/poi-common-database-utf.h
@@ -0,0 +1,59 @@
+/**
+* @licence app begin@
+* SPDX-License-Identifier: MPL-2.0
+*
+* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
+*
+* \file poi-common-database-utf.h
+*
+* \brief This file is part of the poi proof of concept.
+*
+* \author Philippe Colliot <philippe.colliot@mpsa.com>
+*
+* \version 1.1
+*
+* This Source Code Form is subject to the terms of the
+* Mozilla Public License (MPL), 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/.
+*
+* For further information see http://www.genivi.org/.
+*
+* List of changes:
+* 10-02-2014, Philippe Colliot, refinement and migration to the new repository
+* <date>, <name>, <description of change>
+*
+* @licence end@
+*/
+#ifndef __DATABASE_H__
+#define __DATABASE_H__
+
+#include <string>
+#include <vector>
+#include <sqlite3.h>
+#include <glibmm/ustring.h>
+
+using namespace std;
+
+class DatabaseUTF
+{
+ public:
+ DatabaseUTF(const char* filename);
+ ~DatabaseUTF();
+
+ bool open(const char* filename);
+ bool schema();
+ bool add(const char* scheme_filename);
+ vector<vector<Glib::ustring> > query(const char* query);
+ void close();
+ void beginTransaction();
+ void appendTransaction(const char* query);
+ void commitTransaction();
+
+ private:
+ static int callback(void *NotUsed, int argc, char **argv, char **azColName);
+ sqlite3 *database;
+ std::string m_filename;
+};
+
+#endif
diff --git a/src/poi-service/poi-common/poi-common-database.cpp b/src/poi-service/poi-common/poi-common-database.cpp
index 310a631..25b655a 100644
--- a/src/poi-service/poi-common/poi-common-database.cpp
+++ b/src/poi-service/poi-common/poi-common-database.cpp
@@ -30,7 +30,7 @@
#include <iostream>
/**
- * \fn Database(const char* filename)
+ * \fn DatabaseUTF(const char* filename)
* \brief Constructor.
*
* \param const char* filename -name of the database file to open
@@ -44,7 +44,7 @@ Database::Database(const char* filename)
}
/**
- * \fn ~Database()
+ * \fn ~DatabaseUTF()
* \brief Destructor.
*
* \param
@@ -178,59 +178,9 @@ void Database::commitTransaction()
* \brief Query a SQL request.
*
* \param const char* query -SQL request
- * \return vector<vector<Glib::ustring> > -Result of the query
+ * \return vector<vector<string> > -Result of the query
*/
-vector<vector<Glib::ustring> > Database::query(const char* query)
-{
- sqlite3_stmt *statement;
- vector<vector<Glib::ustring> > results;
-
- if(sqlite3_prepare_v2(database, query, -1, &statement, 0) == SQLITE_OK)
- {
- int cols = sqlite3_column_count(statement);
- int result = 0;
- while(true)
- {
- result = sqlite3_step(statement);
-
- if(result == SQLITE_ROW)
- {
- vector<Glib::ustring> values;
- for(int col = 0; col < cols; col++)
- {
- Glib::ustring val;
- char * ptr = (char*)sqlite3_column_text(statement, col);
- if(ptr)
- {
- val = ptr;
- }
- else val = ""; // this can be commented out since std::string val;
- values.push_back(val); // now we will never push NULL
- }
- results.push_back(values);
- }
- else
- {
- break;
- }
- }
-
- sqlite3_finalize(statement);
- }
-
- string error = sqlite3_errmsg(database);
- if(error != "not an error") cout << query << " " << error << endl;
- return results;
-}
-
-/**
- * \fn query(const char* query)
- * \brief Query a SQL request.
- *
- * \param const char* query -SQL request
- * \return vector<vector<Glib::ustring> > -Result of the query
- */
-vector<vector<string> > Database::queryNotUTF(const char* query)
+vector<vector<string> > Database::query(const char* query)
{
sqlite3_stmt *statement;
vector<vector<string> > results;
diff --git a/src/poi-service/poi-common/poi-common-database.h b/src/poi-service/poi-common/poi-common-database.h
index acad203..b642aae 100644
--- a/src/poi-service/poi-common/poi-common-database.h
+++ b/src/poi-service/poi-common/poi-common-database.h
@@ -31,7 +31,6 @@
#include <string>
#include <vector>
#include <sqlite3.h>
-#include <glibmm/ustring.h>
using namespace std;
@@ -44,17 +43,16 @@ class Database
bool open(const char* filename);
bool schema();
bool add(const char* scheme_filename);
- vector<vector<Glib::ustring> > query(const char* query);
- vector<vector<string> > queryNotUTF(const char* query);
+ vector<vector<string> > query(const char* query);
void close();
void beginTransaction();
void appendTransaction(const char* query);
void commitTransaction();
- private:
- static int callback(void *NotUsed, int argc, char **argv, char **azColName);
+ private:
+ static int callback(void *NotUsed, int argc, char **argv, char **azColName);
sqlite3 *database;
- std::string m_filename;
+ std::string m_filename;
};
#endif
diff --git a/src/poi-service/poi-manager-server/CMakeLists.txt b/src/poi-service/poi-manager-server/CMakeLists.txt
index c832967..897565d 100644
--- a/src/poi-service/poi-manager-server/CMakeLists.txt
+++ b/src/poi-service/poi-manager-server/CMakeLists.txt
@@ -47,12 +47,12 @@ 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)
# Source Files
-FILE(GLOB PRJ_LOCAL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${COMMON_DIR}/*.cpp)
-FILE(GLOB PRJ_COMMON_SRCS ${COMMON_DIR}/*.cpp)
+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)
add_subdirectory(${FRANCA_DIR}/poiservice "${CMAKE_CURRENT_BINARY_DIR}/franca")
@@ -67,16 +67,16 @@ include_directories(
${DBUS_INCLUDE_DIRS}
${COMMONAPI_INCLUDE_DIRS}
${COMMONAPI_DBUS_INCLUDE_DIRS}
- ${GLIBMM_INCLUDE_DIRS}
${GOBJECT_INCLUDE_DIRS}
+ ${GLIB_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIRS}
)
link_directories(
${DBUS_LIB_PATH}
+ ${GLIB_LIBRARY_DIRS}
${COMMONAPI_LIBDIR}
${COMMONAPI_DBUS_LIBDIR}
- ${GLIBMM_LIBRARY_DIRS}
${GOBJECT_LIBRARY_DIRS}
${SQLITE3_LIBRARY_DIRS}
)
@@ -85,7 +85,7 @@ set(LIBRARIES
${COMMONAPI_LIBRARIES}
${COMMONAPI_DBUS_LIBRARIES}
${GOBJECT_LIBRARIES}
- ${GLIBMM_LIBRARIES}
+ ${GLIB_LIBRARIES}
${SQLITE3_LIBRARIES}
)
diff --git a/src/poi-service/poi-manager-server/main.cpp b/src/poi-service/poi-manager-server/main.cpp
index c70a075..53b3ceb 100644
--- a/src/poi-service/poi-manager-server/main.cpp
+++ b/src/poi-service/poi-manager-server/main.cpp
@@ -36,6 +36,7 @@
#include <thread>
#include <typeinfo>
#include <getopt.h>
+#include <glib.h>
#include <CommonAPI/CommonAPI.hpp> //Defined in the Common API Runtime library
#include "poi-manager-server-stub.h"
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 9184aa7..b32d4b3 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
@@ -63,7 +63,7 @@ vector<poi_category_common_t> sqlRequest::getAvailableCategories(POIServiceTypes
poi_category_common_t poiCategory;
// retrieve the available categories (the ones that have at least one record)
- query_result = mp_database->queryNotUTF(m_SQL_REQUEST_GET_AVAILABLE_CATEGORIES);
+ query_result = mp_database->query(m_SQL_REQUEST_GET_AVAILABLE_CATEGORIES);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -85,7 +85,7 @@ vector<poi_category_common_t> sqlRequest::getAvailableCategories(POIServiceTypes
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
@@ -105,7 +105,7 @@ vector<poi_category_common_t> sqlRequest::getAvailableCategories(POIServiceTypes
strStream << poiCategory.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
@@ -139,7 +139,7 @@ vector<poi_category_common_t> sqlRequest::getAvailableCategories(POIServiceTypes
strStream << availableCategoryTable.at(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
@@ -166,7 +166,7 @@ vector<poi_category_common_t> sqlRequest::getAvailableCategories(POIServiceTypes
strStream << availableCategoryTable.at(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
@@ -192,7 +192,7 @@ void sqlRequest::getAvailableArea()
double doubleValue;
//retrieve the available area into the database
- query_result = mp_database->queryNotUTF(m_SQL_REQUEST_GET_AVAILABLE_AREA);
+ query_result = mp_database->query(m_SQL_REQUEST_GET_AVAILABLE_AREA);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -242,7 +242,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa
sqlQuery += ",'";
sqlQuery.append(category.getDetails().getName());
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
@@ -265,7 +265,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa
sqlQuery += ",'";
sqlQuery.append((category.getAttributes().at(index)).getName());
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
@@ -313,7 +313,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa
strStream << (category.getAttributes().at(index)).getId();
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
@@ -347,7 +347,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa
strStream << category.getDetails().getParentsId().at(index);
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
@@ -384,7 +384,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa
sqlQuery += "','";
sqlQuery.append(ICON_FORMAT);
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
@@ -410,7 +410,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa
strStream << iconId;
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
@@ -439,7 +439,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::checkIfCategoryNameDoesntExist(std::s
sqlQuery += "'";
sqlQuery += ")";
sqlQuery += m_SQL_RETURN_BOOL_VALUE;
- 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
@@ -474,7 +474,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::checkIfCategoryExist(POIServiceTypes:
sqlQuery += strStream.str();
sqlQuery += ")";
sqlQuery += m_SQL_RETURN_BOOL_VALUE;
- 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
@@ -509,7 +509,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::checkIfPoiExist(POIServiceTypes::POI_
sqlQuery += strStream.str();
sqlQuery += ")";
sqlQuery += m_SQL_RETURN_BOOL_VALUE;
- 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
@@ -550,7 +550,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_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
@@ -565,7 +565,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_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
@@ -580,7 +580,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_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
@@ -595,7 +595,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_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
@@ -610,7 +610,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_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
@@ -625,7 +625,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_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
@@ -641,7 +641,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removeCategory(POIServiceTypes::Categ
strStream << unique_id;
sqlQuery += strStream.str();
sqlQuery += ";";
- query_result = mp_database->queryNotUTF(sqlQuery.c_str());
+ query_result = mp_database->query(sqlQuery.c_str());
// and remove it if necessary
if (query_result.size() != 0)
{
@@ -665,7 +665,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::getFreePoiId(POIServiceTypes::POI_ID
vector<string > query_line;
// retrieve the next free category id
- query_result = mp_database->queryNotUTF(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_POI_ID);
+ query_result = mp_database->query(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_POI_ID);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -689,7 +689,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::getFreeCategoryId(POIServiceTypes::Ca
vector<string > query_line;
// retrieve the next free category id
- query_result = mp_database->queryNotUTF(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_CATEGORY_ID);
+ query_result = mp_database->query(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_CATEGORY_ID);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -713,7 +713,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::getFreeAttributeId(POIServiceTypes::A
vector<string > query_line;
// retrieve the next free category id
- query_result = mp_database->queryNotUTF(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_ATTRIBUTE_ID);
+ query_result = mp_database->query(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_ATTRIBUTE_ID);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -737,7 +737,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::getFreeIconId(iconId_t &unique_id)
vector<string > query_line;
// retrieve the next free category id
- query_result = mp_database->queryNotUTF(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_ICON_ID);
+ query_result = mp_database->query(m_SQL_REQUEST_GET_AVAILABLE_NEXT_FREE_ICON_ID);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -761,7 +761,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::getFreeRecordId(const char* request,
vector<string > query_line;
// retrieve the next free category id
- query_result = mp_database->queryNotUTF(request);
+ query_result = mp_database->query(request);
if (query_result.empty())
{
onError(); //database is not well populated
@@ -794,7 +794,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::checkIfAttributeExist(POIServiceTypes
sqlQuery += strStream.str();
sqlQuery += ")";
sqlQuery += m_SQL_RETURN_BOOL_VALUE;
- 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
@@ -815,7 +815,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::checkIfAttributeExist(POIServiceTypes
sqlQuery += name;
sqlQuery += "')";
sqlQuery += m_SQL_RETURN_BOOL_VALUE;
- 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
@@ -974,7 +974,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createPoi(POIServiceTypes::CategoryID
sqlQuery += "','";
sqlQuery.append(poiRecorded.operateur); // operateur
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
@@ -991,7 +991,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createPoi(POIServiceTypes::CategoryID
sqlQuery += "'";
sqlQuery.append(POI_PROVIDER);
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
@@ -1027,7 +1027,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createPoi(POIServiceTypes::CategoryID
strStream << poiproviderId;
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
@@ -1054,7 +1054,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createPoi(POIServiceTypes::CategoryID
strStream << MEDIASET;
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
@@ -1084,7 +1084,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removePoi(POIServiceTypes::POI_ID uni
strStream << unique_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
@@ -1099,7 +1099,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removePoi(POIServiceTypes::POI_ID uni
strStream << unique_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
@@ -1115,7 +1115,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::removePoi(POIServiceTypes::POI_ID uni
strStream << unique_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
@@ -1188,7 +1188,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::searchPoi(const string &categoryName,
sqlQuery += ")) AND (name LIKE '%";
sqlQuery += search_string;
sqlQuery += "%');";
- query_result = mp_database->queryNotUTF(sqlQuery.c_str());
+ query_result = mp_database->query(sqlQuery.c_str());
// read the result of the query
if (query_result.size() == 0) //get the amount of poi searched
{
diff --git a/src/poi-service/poi-server/CMakeLists.txt b/src/poi-service/poi-server/CMakeLists.txt
index ec16a44..d299c54 100644
--- a/src/poi-service/poi-server/CMakeLists.txt
+++ b/src/poi-service/poi-server/CMakeLists.txt
@@ -25,13 +25,12 @@ find_package(PkgConfig 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)
#common files shared with poi server
-file(GLOB PRJ_COMMON_SRCS ${COMMON_DIR}/*.cpp)
+file(GLOB PRJ_COMMON_SRCS ${COMMON_DIR}/poi-common-database.cpp)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
@@ -42,7 +41,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}
@@ -52,7 +50,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}
@@ -67,7 +64,6 @@ set(LIBRARIES
${DBUS_CPP_LIBRARIES}
${GLIB_LIBRARIES}
${SQLITE3_LIBRARIES}
- ${GLIBMM_LIBRARIES}
${GOBJECT_LIBRARIES}
${DBUS_LIBRARIES}
${DBUS_CPP_GLIB_LIBRARIES}
diff --git a/src/poi-service/poi-server/main.cpp b/src/poi-service/poi-server/main.cpp
index b581e74..1c5a999 100644
--- a/src/poi-service/poi-server/main.cpp
+++ b/src/poi-service/poi-server/main.cpp
@@ -691,7 +691,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
// 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
@@ -713,7 +713,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
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
@@ -733,7 +733,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
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
@@ -764,7 +764,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
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
@@ -791,7 +791,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
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
@@ -808,7 +808,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
}
//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
@@ -1723,7 +1723,7 @@ uint16_t poiSearchServer::searchPOIRequest(uint16_t categoryIndex, std::string s
sqlQuery += ")) AND (name LIKE '%";
sqlQuery += search_string;
sqlQuery += "%');";
- sqlQueryResult = mp_database->queryNotUTF(sqlQuery.c_str());
+ sqlQueryResult = mp_database->query(sqlQuery.c_str());
//populate the table of poi
poi.categoryIndex = categoryIndex;
diff --git a/src/poi-service/run b/src/poi-service/run
deleted file mode 100755
index ca74661..0000000
--- a/src/poi-service/run
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-# @licence app begin@
-# SPDX-License-Identifier: MPL-2.0
-#
-# \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
-#
-# \file run
-#
-# \brief This file is part of the Build System.
-#
-# \author Philippe Colliot <philippe.colliot@mpsa.com>
-#
-# \version 1.0
-#
-# This Source Code Form is subject to the terms of the
-# Mozilla Public License (MPL), 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/.
-#
-# For further information see http://www.genivi.org/.
-#
-# List of changes:
-#
-# <date>, <name>, <description of change>
-#
-# @licence end@
-
-CURDIR=$PWD
-
-BIN_DIR=$CURDIR/bin
-POI_SERVER_BIN_DIR=$BIN_DIR
-POI_MANAGER_BIN_DIR=$BIN_DIR
-RESOURCE_DIR=$CURDIR/resource
-MAIN_DATABASE=$RESOURCE_DIR/poi-database-sample.db
-ADDITIONAL_DATABASE=$RESOURCE_DIR/poi-database-managed.db
-
-echo 'kill reminding orphan process if necessary'
-./kill-all
-
-echo '------------------------start the server------------------------'
-$POI_SERVER_BIN_DIR/poi-server -f $MAIN_DATABASE &
-
-echo '------------------------start the manager server------------------------'
-#$POI_MANAGER_BIN_DIR/poi-manager-server -f $ADDITIONAL_DATABASE &
-
-
-