diff options
author | asanoaozora <fifitaneki@hotmail.com> | 2017-06-12 12:57:49 +0200 |
---|---|---|
committer | asanoaozora <fifitaneki@hotmail.com> | 2017-06-12 12:57:49 +0200 |
commit | b0900a26764f825c7b1d617c2b7c884cd8ceb7a8 (patch) | |
tree | 8945b958d0e907fbae7c21b09612a7d76317d901 /src | |
parent | 3d9f1eed3df79c19b5b1ed0dc14697575be945fa (diff) | |
download | poi-service-b0900a26764f825c7b1d617c2b7c884cd8ceb7a8.tar.gz |
refine test scripts, start test poi cam navit
Diffstat (limited to 'src')
-rwxr-xr-x | src/navigation/build.sh | 75 | ||||
-rw-r--r-- | src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx | 10 | ||||
-rwxr-xr-x | src/navigation/run | 22 | ||||
-rw-r--r-- | src/poi-service/poi-server/main.cpp | 68 | ||||
-rw-r--r-- | src/poi-service/poi-server/poi-server-class.h | 4 |
5 files changed, 125 insertions, 54 deletions
diff --git a/src/navigation/build.sh b/src/navigation/build.sh index d5d3873..806c2b0 100755 --- a/src/navigation/build.sh +++ b/src/navigation/build.sh @@ -3,6 +3,7 @@ clean=0 capi=0 navit=0 +poi=0 dlt_option="-DWITH_DLT=OFF" commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=OFF" @@ -32,7 +33,7 @@ function check_path_for_capi commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=ON -DWITH_DBUS_INTERFACE=OFF -DDBUS_LIB_PATH="$DBUS_LIB_PATH" -DCOMMONAPI_DBUS_TOOL_DIR="$COMMONAPI_DBUS_TOOL_DIR" -DCOMMONAPI_TOOL_DIR="$COMMONAPI_TOOL_DIR } -while getopts cdmn opt +while getopts cdmnp opt do case $opt in c) @@ -47,45 +48,57 @@ do n) navit=1 ;; + p) + poi=1 + ;; \?) echo "Usage:" - echo "$0 [-cdmn]" - echo "-c: build with clean" + echo "$0 [-cdmnp]" + echo "-c: clean and build" echo "-d: build with dlt (only with -c)" echo "-m: build with commonAPI plugins (only with -c) " echo "-n: build navit" + echo "-p: build poi" exit 1 esac done +#check commonapi settings if [ "$capi" = 1 ] then check_path_for_capi fi -if [ "$clean" = 1 ] +#clean +if [ "$clean" = 1 ] && [ -d "./build" ] then - if [ -d "./build" ] + echo 'clean up navigation and positioning' + rm ./build/CMakeCache.txt + rm ./build/cmake_install.cmake + rm ./build/Makefile + rm ./build/positioning/cmake_install.cmake + rm ./build/positioning/Makefile + if [ "$navit" = 1 ] + then + echo 'clean up navit' + rm ./build/navit/CMakeCache.txt + rm ./build/navit/cmake_install.cmake + rm ./build/navit/Makefile + fi + if [ "$poi" = 1 ] && [ -d "../poi-service/build" ] then - if [ "$navit" = 1 ] - then - echo 'clean up the build folder and regenerate all the stuff' - find ./build ! -name '*.cbp' -type f -exec rm -f {} + - else - echo 'clean up the build folder and regenerate all the stuff except navit ' - rm ./build/CMakeCache.txt - rm ./build/cmake_install.cmake - rm ./build/Makefile - rm -rf ./build/positioning - fi + echo 'clean up poi' + rm ../poi-service/build/CMakeCache.txt + rm ../poi-service/build/cmake_install.cmake + rm ../poi-service/build/Makefile fi fi +#navit mkdir -p build cd build mkdir -p navit cd navit - if [ "$navit" = 1 ] then echo 'build navit' @@ -94,19 +107,11 @@ then cmake -DDISABLE_QT=1 -DSAMPLE_MAP=0 -DBUILD_MAPTOOL=0 -Dvehicle/null=1 -Dgraphics/qt_qpainter=0 ../../navit/ fi make -else - if [ "$clean" = 1 ] - then - cmake -DDISABLE_QT=1 -DSAMPLE_MAP=0 -DBUILD_MAPTOOL=0 -Dvehicle/null=1 -Dgraphics/qt_qpainter=0 ../../navit/ - make - fi fi -cd ../ +cd .. + +#navigation echo 'build navigation' -if [ "$capi" = 1 ] -then - echo 'delete <selective> option because DBus does not manage it' -fi if [ "$clean" = 1 ] then cmake $dlt_option $commonapi_tools_option ../ @@ -117,4 +122,18 @@ fi make cd .. +#poi +cd ../poi-service +mkdir -p build +cd build +if [ "$poi" = 1 ] +then + echo 'build poi' + if [ "$clean" = 1 ] + then + cmake -DWITH_PLUGIN_MIGRATION=0 ../ + fi + make +fi +cd ../../navigation diff --git a/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx b/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx index cd73751..456dadc 100644 --- a/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx +++ b/src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx @@ -485,9 +485,17 @@ class MapViewerControl DisplayRoute(const uint32_t& SessionHandle, const uint32_t& MapViewInstanceHandle, const uint32_t& RouteHandle, const bool& highlighted) { MapViewerControlObj *obj=handles[MapViewInstanceHandle]; + std::vector< ::DBus::Struct< uint32_t, bool > > displayedRoutes; + ::DBus::Struct< uint32_t, bool > route; if (!obj) throw DBus::ErrorInvalidArgs("Invalid mapviewinstance handle"); - else obj->DisplayRoute(SessionHandle, RouteHandle, highlighted); + else{ + obj->DisplayRoute(SessionHandle, RouteHandle, highlighted); + route._1 = RouteHandle; + route._2 = highlighted; + displayedRoutes.push_back(route); + DisplayedRoutes(MapViewInstanceHandle,displayedRoutes); + } } void diff --git a/src/navigation/run b/src/navigation/run index d7b62f5..1c7c19f 100755 --- a/src/navigation/run +++ b/src/navigation/run @@ -89,6 +89,7 @@ enhpos=1 replayer=1 verbose=0 #no debug or log messages displayed center="4612 N 0608 E" +poi=0 CUR_DIR=$PWD BIN_DIR=$CUR_DIR/bin @@ -96,7 +97,14 @@ SRC_DIR=$PWD LOGREPLAYER_LOGS_DIR=$SRC_DIR/positioning/log-replayer/logs NAVIT_BIN_DIR=$CUR_DIR/build/navit/navit/ -while getopts c:gnorvx opt +POI_SERVER=poi-server +POI_SERVER_SRC_DIR=$CUR_DIR/../../src/poi-service/$POI_SERVER +POI_SERVER_BIN_DIR=$CUR_DIR/../../src/poi-service/bin +POI_SERVER_RESOURCE_DIR=$CUR_DIR/../../src/poi-service/resource + +poidatabase=$POI_SERVER_RESOURCE_DIR/empty.db # empty poi database by default + +while getopts c:gnoprvx opt do case $opt in c) @@ -125,6 +133,9 @@ do o) log=1 ;; + p) + poi=1 + ;; r) replayer=0 ;; @@ -136,12 +147,13 @@ do ;; \?) echo "Usage:" - echo "$0 [-c center][-gnorvx]" + echo "$0 [-c center][-gnoprvx]" echo "-c: Set center (supported values: paris,tokyo,longitude,latitude). Default is geneve" echo "-g: Run subprocesses within gdb (only with -x)" echo "-n: Don't start enhanced-position-service" echo "-r: Don't start replayer" echo "-o: Create log file of subprocess output" + echo "-p: Launch the poi server" echo "-v: Enable the output debug messages" echo "-x: Run subprocesses in own xterm to get separated log messages" exit 1 @@ -170,6 +182,12 @@ then fi fi +if [ "$poi" = 1 ] +then + # start the poi server + run "POI service" $POI_SERVER_BIN_DIR/$POI_SERVER -f $poidatabase +fi + cd $NAVIT_BIN_DIR >bookmark.txt diff --git a/src/poi-service/poi-server/main.cpp b/src/poi-service/poi-server/main.cpp index 50bb074..ee1e840 100644 --- a/src/poi-service/poi-server/main.cpp +++ b/src/poi-service/poi-server/main.cpp @@ -481,16 +481,14 @@ void poiContentAccessServer::ResetRegisteredAttributeCategoriesFlags(camId_t cam } void poiContentAccessServer::SetRegisteredSearchCategory(camId_t camId, DBus_categoryRadius::categoryRadius_t category) -{ - size_t index; +{ DBus_categoryRadius catRad; if (camId == m_camId) - { //only one cam managed - //firstly clean up the list used for the search - m_poiCategories.clear(); - for (index=0;index<m_poiCategoriesRegistered.size();index++) - { + { //only one cam managed + bool isFound=false; + size_t index=0; + do{ if ((m_poiCategoriesRegistered.at(index)).id == category.id) { (m_poiCategoriesRegistered.at(index)).isSearch = true; @@ -498,8 +496,10 @@ void poiContentAccessServer::SetRegisteredSearchCategory(camId_t camId, DBus_cat (m_poiCategoriesRegistered.at(index)).radius = category.radius; catRad.set(category); m_poiCategories.push_back(catRad.getDBus()); //populate the list used for the search + isFound=true; } - } + index++; + }while((isFound==false)&&(index<m_poiCategoriesRegistered.size())); } } @@ -632,12 +632,9 @@ bool poiContentAccessServer::isAttributeAvailable(attributeId_t attributeId) bool poiContentAccessServer::removeCategoryFromTables(categoryId_t id) { - size_t index; - bool isFound; - //check if category has been registered and remove it - isFound = false; - index = 0; + bool isFound = false; + size_t index = 0; do { if ((m_poiCategoriesRegistered.at(index)).id == id) { @@ -956,12 +953,12 @@ std::vector< DBus_category::DBus_category_t > poiSearchServer::GetCategoriesDeta categoryId_t category_index; camIdName_t cam; + return_value.clear(); // load categories details from the embedded database index=0; - return_value.clear(); - while ((index<categories.size())&&(index < m_availableCategories)) + while (index<categories.size()) { - if ( isCategoryAvailable(categories.at(index),&category_index) == true) + if ( isCategoryAvailable(categories.at(index),m_availableCategories,&category_index) == true) { //category found into the embedded data! categoryDetails.id = m_availableCategoryTable[category_index].id; categoryDetails.parents_id.clear(); @@ -1009,8 +1006,15 @@ std::vector< DBus_category::DBus_category_t > poiSearchServer::GetCategoriesDeta categoryCAMList.clear(); if (mp_poiContentAccess->GetRegisteredCategoriesDetails(cam.id,&categoryCAMList) == true) { - for (index=0;index<categoryCAMList.size();index++) - return_value.push_back((categoryCAMList.at(index)).getDBus()); + index=0; + while (index<categories.size()) + { + if ( isCategoryAvailableInCAM(categories.at(index),categoryCAMList,&category_index) == true) + { + return_value.push_back((categoryCAMList.at(category_index)).getDBus()); + } + index++; + } } } @@ -1143,7 +1147,7 @@ void poiSearchServer::SetCategories(const handleId_t& poiSearchHandle, const std { catRad.setDBus(poiCategories.at(index)); categoryRadius = catRad.get(); - if ( isCategoryAvailable(categoryRadius.id,&category_index) == true) + if ( isCategoryAvailable(categoryRadius.id,m_availableCategories,&category_index) == true) { //category found into the embedded data ! m_availableCategoryTable[category_index].isSearch = true; m_availableCategoryTable[category_index].radius = (categoryRadius.radius)*10; //get the radius (unit is 10 m) @@ -1191,7 +1195,7 @@ void poiSearchServer::SetAttributes(const handleId_t& poiSearchHandle, const std { attribDet.setDBus(poiAttributes[index]); attributeDetails = attribDet.get(); //get the attribute in readable format - if ( isCategoryAvailable(attributeDetails.categoryId,&category_index) == true) + if ( isCategoryAvailable(attributeDetails.categoryId,m_availableCategories,&category_index) == true) { //category found into the embedded database! for (sub_index=0;sub_index<(m_availableCategoryTable[category_index].attributeList.size());sub_index++) { //check attribute by name @@ -1813,7 +1817,7 @@ uint16_t poiSearchServer::searchPOIRequest(uint16_t categoryIndex, std::string s return(sqlQueryResult.size()); } -bool poiSearchServer::isCategoryAvailable(categoryId_t id, categoryId_t *category_id) +bool poiSearchServer::isCategoryAvailable(categoryId_t id, const uint16_t size, categoryId_t *category_id) { bool isFound = false; categoryId_t index = 0; @@ -1826,7 +1830,27 @@ bool poiSearchServer::isCategoryAvailable(categoryId_t id, categoryId_t *categor } else ++index; - } while ((isFound==false) && (index < m_availableCategories)); + } while ((isFound==false) && (index < size)); + + return(isFound); +} + +bool poiSearchServer::isCategoryAvailableInCAM(categoryId_t id, const std::vector<DBus_category> categoryCAMList, categoryId_t *category_id) +{ + bool isFound = false; + DBus_category category; + categoryId_t index = 0; + do + { + category = categoryCAMList.at(index); + if (category.get().details.id == id) + { + *category_id = index; + isFound = true; + } + else + ++index; + } while ((isFound==false) && (index < categoryCAMList.size())); return(isFound); } diff --git a/src/poi-service/poi-server/poi-server-class.h b/src/poi-service/poi-server/poi-server-class.h index 3f90a00..49e12f1 100644 --- a/src/poi-service/poi-server/poi-server-class.h +++ b/src/poi-service/poi-server/poi-server-class.h @@ -298,7 +298,9 @@ private: // category and attribute routines - bool isCategoryAvailable(categoryId_t id, categoryId_t *categoryId_t); + bool isCategoryAvailable(categoryId_t id, const uint16_t size, categoryId_t *category_id); + + bool isCategoryAvailableInCAM(categoryId_t id, const std::vector<DBus_category> categoryCAMList, categoryId_t *category_id); bool isAllCategoriesSelected(uint16_t* index); |