diff options
author | <philippe colliot> | 2016-01-22 17:51:29 +0100 |
---|---|---|
committer | <philippe colliot> | 2016-01-22 17:51:29 +0100 |
commit | beff36aa16fafd01c2b861288900fe57fa2a8bee (patch) | |
tree | 6a5a9cf0c0bc24ccccfc4cf7e551b0e2696bbdf7 | |
parent | 67a3f9b51ee31e828b97251abab75284a5442992 (diff) | |
download | poi-service-beff36aa16fafd01c2b861288900fe57fa2a8bee.tar.gz |
POI manager POCs built against commonAPI 3.1.5, the code ...
5 files changed, 57 insertions, 44 deletions
diff --git a/src/poi-service/poi-manager-server/CMakeLists.txt b/src/poi-service/poi-manager-server/CMakeLists.txt index 56fbe8a..54e8e1e 100644 --- a/src/poi-service/poi-manager-server/CMakeLists.txt +++ b/src/poi-service/poi-manager-server/CMakeLists.txt @@ -18,27 +18,39 @@ project(poi-manager-server) 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 0) -set(API_VERSION_MINOR 1) -set(API_VERSION "v${API_VERSION_MAJOR}_${API_VERSION_MINOR}") +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}/org/genivi/${ROOT_API}) -set(PRJ_SRC_GEN_POISERVICE_TYPES_PATH ${COMMONAPI_GEN_DIR}/v1_0/org/genivi/${ROOT_API}/${PARENT_API}) +set(PRJ_SRC_GEN_POISERVICE_TYPES_PATH ${COMMONAPI_GEN_DIR}/${API_VERSION}/org/genivi/${ROOT_API}/${PARENT_API}) + +# DBus Path +if(DBUS_LIB_PATH) + message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) + set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) + 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") +endif() # Packages find_package(PkgConfig REQUIRED) -find_package(CommonAPI 3.1.2 REQUIRED) -find_package(CommonAPI-DBus 3.1.2 REQUIRED) +find_package(CommonAPI 3.1.5 REQUIRED) +find_package(CommonAPI-DBus 3.1.5 REQUIRED) -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(DBUS "dbus-1 >= 1.8.4") // #to be fixed, it doesn't work so the paths are set manually (see above) +pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.5") +pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1.5") pkg_check_modules(SQLITE3 REQUIRED sqlite3) pkg_check_modules(GOBJECT gobject-2.0) pkg_check_modules(GLIB REQUIRED glib-2.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 index a4345db..fcd00b2 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 @@ -252,18 +252,18 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa } //Check the attributes and complete the table if necessary (poiattribute) - for (index=0;index < category.getAttributes().size();index++) + for (index=0;index < category.getAttributeList().size();index++) { - ret = checkIfAttributeExist((category.getAttributes().at(index)).getId(),(category.getAttributes().at(index)).getName()); + ret = checkIfAttributeExist((category.getAttributeList().at(index)).getId(),(category.getAttributeList().at(index)).getName()); if (ret == ATTRIBUTE_ID_NOT_EXIST) { //Create the attribute sqlQuery = m_SQL_REQUEST_INSERT_ATTRIBUTE; strStream.str(""); - strStream << (category.getAttributes().at(index)).getId(); + strStream << (category.getAttributeList().at(index)).getId(); sqlQuery += strStream.str(); sqlQuery += ",'"; - sqlQuery.append((category.getAttributes().at(index)).getName()); + sqlQuery.append((category.getAttributeList().at(index)).getName()); sqlQuery += "');"; query_result = mp_database->query(sqlQuery.c_str()); if (!query_result.empty()) @@ -310,7 +310,7 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createCategory(POIServiceTypes::CAMCa sqlQuery += strStream.str(); sqlQuery += ","; strStream.str(""); - strStream << (category.getAttributes().at(index)).getId(); + strStream << (category.getAttributeList().at(index)).getId(); sqlQuery += strStream.str(); sqlQuery += ");"; query_result = mp_database->query(sqlQuery.c_str()); @@ -871,45 +871,45 @@ sqlRequest::SQL_REQUEST_ERRORS sqlRequest::createPoi(POIServiceTypes::CategoryID poiRecorded.website = ""; //and scan the poi attributes - for (index=0; index < poi.getAttributes().size();index++) + for (index=0; index < poi.getAttributeList().size();index++) { - switch ((poi.getAttributes().at(index)).getId()) + switch ((poi.getAttributeList().at(index)).getId()) { case ATTRIBUTE_SOURCE: - poiRecorded.source = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.source = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_WEBSITE: - poiRecorded.website = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.website = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_PHONE : - poiRecorded.phone = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.phone = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_STARS: - poiRecorded.stars = (poi.getAttributes().at(index)).getValue().get<int>(); + poiRecorded.stars = (poi.getAttributeList().at(index)).getValue().get<int>(); break; case ATTRIBUTE_OPENINGHOURS: - poiRecorded.openinghours = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.openinghours = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_ADDRHOUSENUMBER: - poiRecorded.addr_house_number = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.addr_house_number = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_ADDRSTREET: - poiRecorded.addr_street = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.addr_street = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_ADDRPOSTCODE: - poiRecorded.addr_postcode = (poi.getAttributes().at(index)).getValue().get<int>(); + poiRecorded.addr_postcode = (poi.getAttributeList().at(index)).getValue().get<int>(); break; case ATTRIBUTE_ADDRCITY: - poiRecorded.addr_city = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.addr_city = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_BRAND: - poiRecorded.brand = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.brand = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_OPERATEUR: - poiRecorded.operateur = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.operateur = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; case ATTRIBUTE_CREDIT_CARD: - poiRecorded.credit_card = (poi.getAttributes().at(index)).getValue().get<std::string>(); + poiRecorded.credit_card = (poi.getAttributeList().at(index)).getValue().get<std::string>(); break; default: return ATTRIBUTE_ID_NOT_EXIST; 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 0435bc7..18e583a 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 @@ -31,8 +31,8 @@ #include <org/genivi/CommonTypes.hpp> #include <org/genivi/navigation/NavigationTypes.hpp> -#include <v0_1/org/genivi/navigation/poiservice/POIServiceTypes.hpp> -#include <v0_1/org/genivi/navigation/poiservice/POIContentAccessModuleStubDefault.hpp> +#include <v0/org/genivi/navigation/poiservice/POIServiceTypes.hpp> +#include <v0/org/genivi/navigation/poiservice/POIContentAccessModuleStubDefault.hpp> #include "poi-common-database.h" @@ -41,7 +41,7 @@ #include "poi-common-math.h" using namespace std; -using namespace v0_1::org::genivi::navigation::poiservice; +using namespace v0::org::genivi::navigation::poiservice; using namespace org::genivi::navigation; using namespace org::genivi; diff --git a/test/poi-service/poi-manager-client/CMakeLists.txt b/test/poi-service/poi-manager-client/CMakeLists.txt index 78636b2..cd726e3 100644 --- a/test/poi-service/poi-manager-client/CMakeLists.txt +++ b/test/poi-service/poi-manager-client/CMakeLists.txt @@ -24,30 +24,30 @@ set(CMAKE_CXX_FLAGS "-Wall -std=c++0x") set(PARENT_API poiservice) set(ROOT_API navigation) set(API_VERSION_MAJOR 0) -set(API_VERSION_MINOR 1) -set(API_VERSION "v${API_VERSION_MAJOR}_${API_VERSION_MINOR}") +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}/org/genivi/${ROOT_API}) -set(PRJ_SRC_GEN_POISERVICE_TYPES_PATH ${COMMONAPI_GEN_DIR}/v1_0/org/genivi/${ROOT_API}/${PARENT_API}) - -set(DBUS_LIB_PATH "/usr/local/lib") +set(PRJ_SRC_GEN_POISERVICE_TYPES_PATH ${COMMONAPI_GEN_DIR}/${API_VERSION}/org/genivi/${ROOT_API}/${PARENT_API}) # DBus Path if (DBUS_LIB_PATH) message(STATUS "DBUS_LIB_PATH = " ${DBUS_LIB_PATH}) + set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include) + 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") endif() # Packages find_package(PkgConfig REQUIRED) -find_package(CommonAPI 3.1.2 REQUIRED) -find_package(CommonAPI-DBus 3.1.2 REQUIRED) +find_package(CommonAPI 3.1.5 REQUIRED) +find_package(CommonAPI-DBus 3.1.5 REQUIRED) -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(DBUS "dbus-1 >= 1.8.4") // #to be fixed, it doesn't work so the paths are set manually (see above) +pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.5") +pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1.5") pkg_check_modules(SQLITE3 REQUIRED sqlite3) pkg_check_modules(GOBJECT gobject-2.0) @@ -94,6 +94,7 @@ set(LIBRARIES ${COMMONAPI_DBUS_LIBRARIES} ${GOBJECT_LIBRARIES} ${SQLITE3_LIBRARIES} + ${DBUS_LIBRARIES} ${GLIB_LIBRARIES} ${GTK_LIBRARIES} diff --git a/test/poi-service/poi-manager-client/main.cpp b/test/poi-service/poi-manager-client/main.cpp index 6e59ac4..2a0eb3b 100644 --- a/test/poi-service/poi-manager-client/main.cpp +++ b/test/poi-service/poi-manager-client/main.cpp @@ -40,12 +40,12 @@ #include <functional> #include <CommonAPI/CommonAPI.hpp> //Defined in the Common API Runtime library -#include <v0_1/org/genivi/navigation/poiservice/POIContentAccessModuleProxy.hpp> +#include <v0/org/genivi/navigation/poiservice/POIContentAccessModuleProxy.hpp> #include "poi-common-data-model.h" using namespace std; -using namespace v0_1::org::genivi::navigation; +using namespace v0::org::genivi::navigation; using namespace poiservice; using namespace org::genivi::navigation; using namespace org::genivi; @@ -158,7 +158,7 @@ contentManager::contentManager(std::shared_ptr<POIContentAccessModuleProxyDefaul categoryOperatorList.push_back(categoryOperator); categoryAttribute.setOperators(categoryOperatorList); categoryAttributeList.push_back(categoryAttribute); - m_category.setAttributes(categoryAttributeList); + m_category.setAttributeList(categoryAttributeList); categorySortOption.setId(POIServiceTypes::SortOption::SORT_DEFAULT); categorySortOption.setName(""); @@ -183,7 +183,7 @@ contentManager::contentManager(std::shared_ptr<POIContentAccessModuleProxyDefaul POIServiceTypes::AttributeValue v(NEW_STARS_VALUE); poiAttribute.setValue(v); poiAttributeList.push_back(poiAttribute); - m_poi.setAttributes(poiAttributeList); + m_poi.setAttributeList(poiAttributeList); // init of the data test for search string m_strTest = SEARCH_STRING; |