summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2017-06-12 12:57:49 +0200
committerasanoaozora <fifitaneki@hotmail.com>2017-06-12 12:57:49 +0200
commitb0900a26764f825c7b1d617c2b7c884cd8ceb7a8 (patch)
tree8945b958d0e907fbae7c21b09612a7d76317d901
parent3d9f1eed3df79c19b5b1ed0dc14697575be945fa (diff)
downloadpoi-service-b0900a26764f825c7b1d617c2b7c884cd8ceb7a8.tar.gz
refine test scripts, start test poi cam navit
-rwxr-xr-xsrc/navigation/build.sh75
-rw-r--r--src/navigation/map-viewer/mapviewercontrol-plugin/genivi_mapviewer_mapviewercontrol.cxx10
-rwxr-xr-xsrc/navigation/run22
-rw-r--r--src/poi-service/poi-server/main.cpp68
-rw-r--r--src/poi-service/poi-server/poi-server-class.h4
-rw-r--r--test/navigation/script/genivi.py43
-rw-r--r--test/navigation/script/lbs-api-test.e4p4
-rwxr-xr-xtest/navigation/script/test-address-input.py77
-rwxr-xr-xtest/navigation/script/test-guidance.py106
-rwxr-xr-xtest/navigation/script/test-location-input.py113
-rwxr-xr-xtest/navigation/script/test-map-viewer-control.py29
-rwxr-xr-xtest/navigation/script/test-poi.py118
-rwxr-xr-xtest/navigation/script/test-route-calculation.py75
13 files changed, 410 insertions, 334 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);
diff --git a/test/navigation/script/genivi.py b/test/navigation/script/genivi.py
new file mode 100644
index 0000000..2b07f82
--- /dev/null
+++ b/test/navigation/script/genivi.py
@@ -0,0 +1,43 @@
+#constants as defined in the Navigation API
+LATITUDE = 0x00a0
+LONGITUDE = 0x00a1
+ALTITUDE = 0x00a2
+
+TOTAL_TIME = 0x018e
+TOTAL_DISTANCE = 0x018f
+ROAD_NAME = 0x0147
+START_LATITUDE = 0x0141
+END_LATITUDE = 0x0142
+START_LONGITUDE = 0x0143
+END_LONGITUDE = 0x0144
+DISTANCE = 0x0148
+TIME = 0x0149
+SPEED = 0x00a4
+ACTIVE = 0x0060
+
+FULL_ADDRESS = 0x00b2
+COUNTRY = 0x00a6
+STATE = 0x00a7
+CITY = 0x00a8
+ZIPCODE = 0x00a9
+STREET = 0x00aa
+HOUSE_NUMBER = 0x00ab
+CROSSING = 0x00ac
+DISTRICT = 0x00ad
+PHONE_NUMBER = 0x00ae
+POI_NAME = 0x00af
+TOWN_CENTER = 0x00b0
+FINISHED = 0x00c2
+
+SEARCH_FINISHED = 0x0200
+SEARCH_NOT_STARTED = 0x01FE
+SORT_BY_DISTANCE = 0x0231
+
+MAPVIEWER_MAX = 0x0041
+MAPVIEWER_MIN = 0x0040
+PERSPECTIVE_TWO_D = 0x0020
+PERSPECTIVE_THREE_D = 0x0021
+MAIN_MAP = 0x0010
+SPLIT_SCREEN = 0x0011
+
+LOCALE = 0x0025
diff --git a/test/navigation/script/lbs-api-test.e4p b/test/navigation/script/lbs-api-test.e4p
index d909056..e321337 100644
--- a/test/navigation/script/lbs-api-test.e4p
+++ b/test/navigation/script/lbs-api-test.e4p
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
<!-- eric project file for project lbs-api-test -->
-<!-- Saved: 2017-05-23, 15:56:05 -->
+<!-- Saved: 2017-06-08, 15:30:45 -->
<!-- Copyright (C) 2017 asanoaozora, -->
<Project version="5.1">
<Language>en_US</Language>
@@ -12,6 +12,7 @@
<Version>0.1</Version>
<Author>asanoaozora</Author>
<Email></Email>
+ <Eol index="-1"/>
<Sources>
<Source>__init__.py</Source>
<Source>dltTrigger.py</Source>
@@ -22,6 +23,7 @@
<Source>test-location-input.py</Source>
<Source>test-map-viewer-control-single.py</Source>
<Source>test-route-calculation.py</Source>
+ <Source>genivi.py</Source>
</Sources>
<Forms/>
<Translations/>
diff --git a/test/navigation/script/test-address-input.py b/test/navigation/script/test-address-input.py
index a9b6ce6..4ba732f 100755
--- a/test/navigation/script/test-address-input.py
+++ b/test/navigation/script/test-address-input.py
@@ -7,6 +7,7 @@
* SPDX-License-Identifier: MPL-2.0
*
* @copyright Copyright (C) 2014, Alpine Electronics R&D Europe GmbH
+* \copyright Copyright (C) 2017, PSA GROUP
*
* @file test-address-input.py
*
@@ -31,35 +32,17 @@
import dbus
import gobject
import dbus.mainloop.glib
-from xml.dom.minidom import parse
import xml.dom.minidom
import argparse
import sys
import errno
+import genivi
from dltTrigger import *
#import pdb;pdb.set_trace()
#name of the test
test_name = "address input"
-# constants as defined in the Navigation API
-LATITUDE = 0x00a0
-LONGITUDE = 0x00a1
-ALTITUDE = 0x00a2
-FULL_ADDRESS = 0x00b2
-COUNTRY = 0x00a6
-STATE = 0x00a7
-CITY = 0x00a8
-ZIPCODE = 0x00a9
-STREET = 0x00aa
-HOUSE_NUMBER = 0x00ab
-CROSSING = 0x00ac
-DISTRICT = 0x00ad
-PHONE_NUMBER = 0x00ae
-POI_NAME = 0x00af
-TOWN_CENTER = 0x00b0
-FINISHED = 0x00c2
-
# List of addresses
COUNTRY_STRING = list()
CITY_STRING = list()
@@ -114,27 +97,27 @@ def vprint(text):
# Turn selection criteria values to their corresponding string description
def selection_criterion_to_string(selection_criterion):
return_value = ''
- if selection_criterion == LATITUDE:
+ if selection_criterion == genivi.LATITUDE:
return_value += 'Latitude'
- elif selection_criterion == LONGITUDE:
+ elif selection_criterion == genivi.LONGITUDE:
return_value += 'Longitude'
- elif selection_criterion == COUNTRY:
+ elif selection_criterion == genivi.COUNTRY:
return_value += 'Country'
- elif selection_criterion == STATE:
+ elif selection_criterion == genivi.STATE:
return_value += 'State'
- elif selection_criterion == CITY:
+ elif selection_criterion == genivi.CITY:
return_value += 'City'
- elif selection_criterion == TOWN_CENTER:
+ elif selection_criterion == genivi.TOWN_CENTER:
return_value += 'City center'
- elif selection_criterion == ZIPCODE:
+ elif selection_criterion == genivi.ZIPCODE:
return_value += 'ZipCode'
- elif selection_criterion == STREET:
+ elif selection_criterion == genivi.STREET:
return_value += 'Street'
- elif selection_criterion == HOUSE_NUMBER:
+ elif selection_criterion == genivi.HOUSE_NUMBER:
return_value += 'House number'
- elif selection_criterion == CROSSING:
+ elif selection_criterion == genivi.CROSSING:
return_value += 'Crossing'
- elif selection_criterion == FULL_ADDRESS:
+ elif selection_criterion == genivi.FULL_ADDRESS:
return_value += 'Full address'
else:
return_value += str(selection_criterion)
@@ -216,20 +199,20 @@ def evaluate_address(address, guidable):
print('\nAddress complete!\nEvaluating...')
if COUNTRY_STRING[current_address_index] == '':
test_passed = 1
- elif address[COUNTRY][1] == COUNTRY_STRING[current_address_index]:
- print ('Country\t\t\t-> ok (' + address[COUNTRY][1] + ')')
+ elif address[genivi.COUNTRY][1] == COUNTRY_STRING[current_address_index]:
+ print ('Country\t\t\t-> ok (' + address[genivi.COUNTRY][1] + ')')
if CITY_STRING[current_address_index] == '':
test_passed = 1
- elif address[CITY][1] == CITY_STRING[current_address_index]:
- print ('City\t\t\t-> ok (' + address[CITY][1] + ')')
+ elif address[genivi.CITY][1] == CITY_STRING[current_address_index]:
+ print ('City\t\t\t-> ok (' + address[genivi.CITY][1] + ')')
if STREET_STRING[current_address_index] == '':
test_passed = 1
- elif address[STREET][1] == STREET_STRING[current_address_index]:
- print ('Street\t\t\t-> ok (' + address[STREET][1] + ')')
+ elif address[genivi.STREET][1] == STREET_STRING[current_address_index]:
+ print ('Street\t\t\t-> ok (' + address[genivi.STREET][1] + ')')
if HOUSE_NUMBER_STRING[current_address_index] == '':
test_passed = 1
- elif address[HOUSE_NUMBER][1] == HOUSE_NUMBER_STRING[current_address_index]:
- print ('House number\t-> ok (' + address[HOUSE_NUMBER][1] + ')')
+ elif address[genivi.HOUSE_NUMBER][1] == HOUSE_NUMBER_STRING[current_address_index]:
+ print ('House number\t-> ok (' + address[genivi.HOUSE_NUMBER][1] + ')')
test_passed = 1
if guidable == 1:
@@ -255,7 +238,7 @@ def evaluate_address(address, guidable):
def search_status_handler(handle,status):
vprint('\n::Search status ' + str(int(status)))
- if status == FINISHED:
+ if status == genivi.FINISHED:
location_input_interface.RequestListUpdate(dbus.UInt32(session_handle), dbus.UInt32(handle),
dbus.UInt16(0),
dbus.UInt16(WINDOW_SIZE))
@@ -271,16 +254,16 @@ def content_updated_handler(handle, guidable, available_selection_criteria, addr
vprint('\tAvailable selection criteria = ' + selection_criteria_array_to_string(available_selection_criteria))
vprint('\tADDRESS: '+dictionary_to_string(address))
- if current_selection_criterion == COUNTRY:
- change_selection_criterion(CITY)
+ if current_selection_criterion == genivi.COUNTRY:
+ change_selection_criterion(genivi.CITY)
target_search_string = CITY_STRING[current_address_index]
- elif current_selection_criterion == CITY:
- change_selection_criterion(STREET)
+ elif current_selection_criterion == genivi.CITY:
+ change_selection_criterion(genivi.STREET)
target_search_string = STREET_STRING[current_address_index]
- elif current_selection_criterion == STREET:
- change_selection_criterion(HOUSE_NUMBER)
+ elif current_selection_criterion == genivi.STREET:
+ change_selection_criterion(genivi.HOUSE_NUMBER)
target_search_string = HOUSE_NUMBER_STRING[current_address_index]
- elif current_selection_criterion == HOUSE_NUMBER:
+ elif current_selection_criterion == genivi.HOUSE_NUMBER:
target_search_string = ''
entered_search_string = ''
if target_search_string == '':
@@ -370,7 +353,7 @@ def startSearch(address_index):
available_characters = ''
target_search_string = COUNTRY_STRING[current_address_index]
- change_selection_criterion(COUNTRY)
+ change_selection_criterion(genivi.COUNTRY)
full_string_search(location_input_handle, target_search_string)
startTrigger(test_name)
diff --git a/test/navigation/script/test-guidance.py b/test/navigation/script/test-guidance.py
index be44295..74be6ac 100755
--- a/test/navigation/script/test-guidance.py
+++ b/test/navigation/script/test-guidance.py
@@ -6,6 +6,7 @@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2016, XS Embedded GmbH, PCA Peugeot Citroen
+* \copyright Copyright (C) 2017, PSA GROUP
*
* \file test-guidance.py
*
@@ -29,39 +30,19 @@
import dbus
import gobject
import dbus.mainloop.glib
-from collections import namedtuple,defaultdict
-from _dbus_bindings import Int32
-from PIL.GimpGradientFile import SEGMENTS
-from xml.dom.minidom import parse
import xml.dom.minidom
import argparse
import sys
import errno
import time
+import genivi
from dltTrigger import *
#import pdb
#pdb.set_trace()
-from pip import locations
-
#name of the test
test_name = "guidance"
-#constants as defined in the Navigation API
-GENIVI_NAVIGATIONCORE_LATITUDE = 0x00a0
-GENIVI_NAVIGATIONCORE_LONGITUDE = 0x00a1
-GENIVI_NAVIGATIONCORE_TOTAL_TIME = 0x018e
-GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE = 0x018f
-GENIVI_NAVIGATIONCORE_ROAD_NAME = 0x0147
-GENIVI_NAVIGATIONCORE_START_LATITUDE = 0x0141
-GENIVI_NAVIGATIONCORE_END_LATITUDE = 0x0142
-GENIVI_NAVIGATIONCORE_START_LONGITUDE = 0x0143
-GENIVI_NAVIGATIONCORE_END_LONGITUDE = 0x0144
-GENIVI_NAVIGATIONCORE_DISTANCE = 0x0148
-GENIVI_NAVIGATIONCORE_TIME = 0x0149
-GENIVI_NAVIGATIONCORE_SPEED = 0x00a4
-GENIVI_NAVIGATIONCORE_ACTIVE = 0x0060
-
#constants used into the script
TIME_OUT = 10000
HORIZONTAL_SIZE = 800
@@ -72,36 +53,36 @@ ZOOM_GUIDANCE = 2
#add signal receivers
def routing_routeCalculationProgressUpdate_handler(routeHandle, status, percentage):
- print 'Route Calculation: ' + str(int(percentage)) + ' %'
+ print ('Route Calculation: ' + str(int(percentage)) + ' %')
def routing_routeCalculationSuccessful_handler(routeHandle,unfullfilledPreferences):
global g_guidance_active
- print 'Route Calculation Successfull: ' + str(routeHandle)
+ print ('Route Calculation Successfull: ' + str(routeHandle))
#get route overview
- overview = g_routing_interface.GetRouteOverview(dbus.UInt32(g_route_handle),dbus.Array([dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE),dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME)]))
+ overview = g_routing_interface.GetRouteOverview(dbus.UInt32(g_route_handle),dbus.Array([dbus.Int32(genivi.TOTAL_DISTANCE),dbus.Int32(genivi.TOTAL_TIME)]))
#retrieve distance
- totalDistance = dbus.Struct(overview[dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE)])
- print 'Total Distance: ' + str(totalDistance[1]/1000) + ' km'
- totalTime = dbus.Struct(overview[dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME)])
+ totalDistance = dbus.Struct(overview[dbus.Int32(genivi.TOTAL_DISTANCE)])
+ print ('Total Distance: ' + str(totalDistance[1]/1000) + ' km')
+ totalTime = dbus.Struct(overview[dbus.Int32(genivi.TOTAL_TIME)])
m, s = divmod(totalTime[1], 60)
h, m = divmod(m, 60)
- print "Total Time: %d:%02d:%02d" % (h, m, s)
+ print ("Total Time: %d:%02d:%02d" % (h, m, s))
#get route segments GetRouteSegments(const uint32_t& routeHandle, const int16_t& detailLevel, const std::vector< DBusCommonAPIEnumeration >& valuesToReturn, const uint32_t& numberOfSegments, const uint32_t& offset, uint32_t& totalNumberOfSegments, std::vector< std::map< DBusCommonAPIEnumeration, DBusCommonAPIVariant > >& routeSegments)
- valuesToReturn = [dbus.Int32(GENIVI_NAVIGATIONCORE_ROAD_NAME),
- dbus.Int32(GENIVI_NAVIGATIONCORE_START_LATITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_END_LATITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_START_LONGITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_END_LONGITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_DISTANCE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_TIME),
- dbus.Int32(GENIVI_NAVIGATIONCORE_SPEED)]
+ valuesToReturn = [dbus.Int32(genivi.ROAD_NAME),
+ dbus.Int32(genivi.START_LATITUDE),
+ dbus.Int32(genivi.END_LATITUDE),
+ dbus.Int32(genivi.START_LONGITUDE),
+ dbus.Int32(genivi.END_LONGITUDE),
+ dbus.Int32(genivi.DISTANCE),
+ dbus.Int32(genivi.TIME),
+ dbus.Int32(genivi.SPEED)]
numberOfSegments = NUMBER_OF_SEGMENTS
detailLevel = 0
offset = 0
ret = g_routing_interface.GetRouteSegments(dbus.UInt32(g_route_handle),dbus.Int16(detailLevel),dbus.Array(valuesToReturn),dbus.UInt32(numberOfSegments),dbus.UInt32(offset))
- print "Total number of segments: " + str(ret[0])
+ print ("Total number of segments: " + str(ret[0]) )
#len(ret[1]) is size
- #ret[1][0][GENIVI_NAVIGATIONCORE_START_LATITUDE] is the start latitude
+ #ret[1][0][genivi.START_LATITUDE] is the start latitude
g_guidance_active = True
# pdb.set_trace()
display_route(routeHandle)
@@ -110,9 +91,9 @@ def routing_routeCalculationSuccessful_handler(routeHandle,unfullfilledPreferenc
def session_sessionDeleted_handler(sessionHandle):
print('Session handle deleted: '+str(sessionHandle))
if sessionHandle == g_navigationcore_session_handle:
- print 'Test PASSED'
+ print ('Test PASSED')
else:
- print 'Test FAILED'
+ print ('Test FAILED')
exit()
def routing_routeDeleted_handler(routeHandle):
@@ -121,7 +102,7 @@ def routing_routeDeleted_handler(routeHandle):
def guidance_guidanceStatusChanged_handler(guidanceStatus,routeHandle):
global g_guidance_active
print('Guidance status changed: '+str(guidanceStatus))
- if guidanceStatus != GENIVI_NAVIGATIONCORE_ACTIVE and g_guidance_active == True:
+ if guidanceStatus != genivi.ACTIVE and g_guidance_active == True:
g_guidance_active = False
route = g_current_route + 1
if route < routes.length:
@@ -132,26 +113,25 @@ def guidance_guidanceStatusChanged_handler(guidanceStatus,routeHandle):
g_navigationcore_session_interface.DeleteSession(dbus.UInt32(g_navigationcore_session_handle))
def guidance_positionOnRouteChanged_handler(offsetOnRoute):
- print "Offset on route: " +str(offsetOnRoute)
+ print ("Offset on route: " +str(offsetOnRoute))
def guidance_maneuverChanged_handler(maneuver):
- print "Maneuver: " +str(maneuver)
+ print ("Maneuver: " +str(maneuver))
ret = g_guidance_interface.GetDestinationInformation()
- print "Travel time: " +str(ret[1])
+ print ("Travel time: " +str(ret[1]))
ret = g_guidance_interface.GetManeuversList(dbus.UInt16(10),dbus.UInt32(0))
- print "Number of maneuvers: " +str(ret[1])
- print "Next road to turn: " +str(ret[2][0][4])
+ print ("Number of maneuvers: " +str(ret[1]))
+ print ("Next road to turn: " +str(ret[2][0][4]))
g_mapmatchedposition_interface.SetSimulationMode(dbus.UInt32(g_navigationcore_session_handle),dbus.Boolean(False))
g_guidance_interface.StopGuidance(dbus.UInt32(g_navigationcore_session_handle))
def mapmatchedposition_simulationStatusChanged_handler(simulationStatus):
- print "Simulation status: " +str(simulationStatus)
+ print ("Simulation status: " +str(simulationStatus))
-#timeout
def timeout():
- print 'Timeout Expired'
- print '\nTest FAILED'
+ print ('Timeout Expired')
+ print ('\nTest FAILED')
exit()
def exit():
@@ -187,25 +167,25 @@ def launch_route_calculation(route):
global g_routing_interface
global g_navigationcore_session_handle
g_current_route = route
- print 'Route name: '+routes[g_current_route].getElementsByTagName("name")[0].childNodes[0].data
+ print ('Route name: '+routes[g_current_route].getElementsByTagName("name")[0].childNodes[0].data)
#get route handle
ret = g_routing_interface.CreateRoute(dbus.UInt32(g_navigationcore_session_handle))
g_route_handle=ret[1]
routes[g_current_route].getElementsByTagName("handle")[0].childNodes[0].data = g_route_handle
- print 'Route handle: ' + str(g_route_handle)
+ print ('Route handle: ' + str(g_route_handle))
start = routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data
dest = routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data
- print 'Calculating route from \
-'+start+'(' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1]) + ') to \
-'+dest+'(' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1]) + ')'
+ print ('Calculating route from \
+ '+start+'(' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1]) + ') to \
+ '+dest+'(' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1]) + ')' )
#set waypoints
waypointDoubleCapiType = 0x03
g_routing_interface.SetWaypoints(dbus.UInt32(g_navigationcore_session_handle), \
dbus.UInt32(g_route_handle), \
dbus.Boolean(0), \
dbus.Array([ \
- dbus.Dictionary({dbus.Int32(GENIVI_NAVIGATIONCORE_LATITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0])]),dbus.Int32(GENIVI_NAVIGATIONCORE_LONGITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1])])}), \
- dbus.Dictionary({dbus.Int32(GENIVI_NAVIGATIONCORE_LATITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0])]),dbus.Int32(GENIVI_NAVIGATIONCORE_LONGITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1])])}) \
+ dbus.Dictionary({dbus.Int32(genivi.LATITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0])]),dbus.Int32(genivi.LONGITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1])])}), \
+ dbus.Dictionary({dbus.Int32(genivi.LATITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0])]),dbus.Int32(genivi.LONGITUDE):dbus.Struct([dbus.Byte(waypointDoubleCapiType),dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1])])}) \
]) \
)
@@ -221,13 +201,13 @@ def createMapView():
#get mapviewer session handle
ret = g_mapviewer_session_interface.CreateSession(dbus.String('test mapviewer'))
g_mapviewer_sessionhandle=ret[1]
- print 'Mapviewer session handle: ' + str(g_mapviewer_sessionhandle)
+ print ('Mapviewer session handle: ' + str(g_mapviewer_sessionhandle))
g_mapviewer_sessionstatus = g_mapviewer_session_interface.GetSessionStatus(dbus.UInt32(g_mapviewer_sessionhandle));
- print 'Mapviewer session status: ' + str(g_mapviewer_sessionstatus)
+ print ('Mapviewer session status: ' + str(g_mapviewer_sessionstatus))
g_mapviewer_sessionlist = g_mapviewer_session_interface.GetAllSessions();
- print 'Mapviewer active sessions = ' + str(len(g_mapviewer_sessionlist))
+ print ('Mapviewer active sessions = ' + str(len(g_mapviewer_sessionlist)))
#get mapviewer handle
ret = g_mapviewercontrol_interface.CreateMapViewInstance( \
@@ -236,11 +216,11 @@ def createMapView():
dbus.Int32(MAIN_MAP))
g_mapviewer_maphandle=ret[1]
- print 'MapView handle: ' + str(g_mapviewer_maphandle)
+ print ('MapView handle: ' + str(g_mapviewer_maphandle))
time.sleep(2)
- print 'Stop following the car position'
+ print ('Stop following the car position')
g_mapviewercontrol_interface.SetFollowCarMode( \
dbus.UInt32(g_mapviewer_sessionhandle), \
dbus.UInt32(g_mapviewer_maphandle), \
@@ -345,7 +325,7 @@ g_mapmatchedposition_interface = dbus.Interface(g_mapmatchedposition_obj, dbus_i
#get navigationcore session handle
ret = g_navigationcore_session_handle = g_navigationcore_session_interface.CreateSession(dbus.String("test guidance"))
g_navigationcore_session_handle=ret[1]
-print 'Navigation core session handle: ' + str(g_navigationcore_session_handle)
+print ('Navigation core session handle: ' + str(g_navigationcore_session_handle))
createMapView()
diff --git a/test/navigation/script/test-location-input.py b/test/navigation/script/test-location-input.py
index 935c1f9..c16388e 100755
--- a/test/navigation/script/test-location-input.py
+++ b/test/navigation/script/test-location-input.py
@@ -7,6 +7,7 @@
* SPDX-License-Identifier: MPL-2.0
*
* @copyright Copyright (C) 2014, Alpine Electronics R&D Europe GmbH
+* \copyright Copyright (C) 2017, PSA GROUP
*
* @file test-location-input.py
*
@@ -31,35 +32,17 @@
import dbus
import gobject
import dbus.mainloop.glib
-from xml.dom.minidom import parse
import xml.dom.minidom
import argparse
import sys
import errno
+import genivi
from dltTrigger import *
#import pdb;pdb.set_trace()
#name of the test
test_name = "location input"
-# constants as defined in the Navigation API
-LATITUDE = 0x00a0
-LONGITUDE = 0x00a1
-ALTITUDE = 0x00a2
-FULL_ADDRESS = 0x00b2
-COUNTRY = 0x00a6
-STATE = 0x00a7
-CITY = 0x00a8
-ZIPCODE = 0x00a9
-STREET = 0x00aa
-HOUSE_NUMBER = 0x00ab
-CROSSING = 0x00ac
-DISTRICT = 0x00ad
-PHONE_NUMBER = 0x00ae
-POI_NAME = 0x00af
-TOWN_CENTER = 0x00b0
-FINISHED = 0x00c2
-
# List of addresses
COUNTRY_STRING = list()
CITY_STRING = list()
@@ -75,9 +58,9 @@ city_search_mode = 0
street_search_mode = 1 #set to full because of a bug to be fixed in the plug-in
house_number_search_mode = 1
-print '\n--------------------------\n' + \
+print ('\n--------------------------\n' + \
'LocationInput Test' + \
- '\n--------------------------\n'
+ '\n--------------------------\n')
parser = argparse.ArgumentParser(description='Location input Test for navigation PoC and FSA.')
parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format')
@@ -120,27 +103,27 @@ def vprint(text):
# Turn selection criteria values to their corresponding string description
def selection_criterion_to_string(selection_criterion):
return_value = ''
- if selection_criterion == LATITUDE:
+ if selection_criterion == genivi.LATITUDE:
return_value += 'Latitude'
- elif selection_criterion == LONGITUDE:
+ elif selection_criterion == genivi.LONGITUDE:
return_value += 'Longitude'
- elif selection_criterion == COUNTRY:
+ elif selection_criterion == genivi.COUNTRY:
return_value += 'Country'
- elif selection_criterion == STATE:
+ elif selection_criterion == genivi.STATE:
return_value += 'State'
- elif selection_criterion == CITY:
+ elif selection_criterion == genivi.CITY:
return_value += 'City'
- elif selection_criterion == TOWN_CENTER:
+ elif selection_criterion == genivi.TOWN_CENTER:
return_value += 'City center'
- elif selection_criterion == ZIPCODE:
+ elif selection_criterion == genivi.ZIPCODE:
return_value += 'ZipCode'
- elif selection_criterion == STREET:
+ elif selection_criterion == genivi.STREET:
return_value += 'Street'
- elif selection_criterion == HOUSE_NUMBER:
+ elif selection_criterion == genivi.HOUSE_NUMBER:
return_value += 'House number'
- elif selection_criterion == CROSSING:
+ elif selection_criterion == genivi.CROSSING:
return_value += 'Crossing'
- elif selection_criterion == FULL_ADDRESS:
+ elif selection_criterion == genivi.FULL_ADDRESS:
return_value += 'Full address'
else:
return_value += str(selection_criterion)
@@ -228,13 +211,13 @@ def spell_search(handle, entered_string, search_string, valid_characters, first=
location_input_interface.Spell(dbus.UInt32(session_handle), dbus.UInt32(handle),
dbus.String(spell_character), dbus.UInt16(20))
else:
- print 'TEST FAILED (Target character can not be entered)'
+ print ('TEST FAILED (Target character can not be entered)')
exit()
else:
- print 'TEST FAILED (Unexpected completion)'
+ print ('TEST FAILED (Unexpected completion)')
exit()
else:
- print 'Full spell match'
+ print ('Full spell match')
# Full string search
@@ -252,39 +235,39 @@ def full_string_search(handle, search_string):
def evaluate_address(address, guidable):
test_passed = 0
- print '\nAddress complete!\nEvaluating...'
+ print ('\nAddress complete!\nEvaluating...')
if COUNTRY_STRING[current_address_index] == '':
test_passed = 1
- elif address[COUNTRY][1] == COUNTRY_STRING[current_address_index]:
- print 'Country\t\t\t-> ok (' + address[COUNTRY][1] + ')'
+ elif address[genivi.COUNTRY][1] == COUNTRY_STRING[current_address_index]:
+ print ('Country\t\t\t-> ok (' + address[genivi.COUNTRY][1] + ')')
if CITY_STRING[current_address_index] == '':
test_passed = 1
- elif address[CITY][1] == CITY_STRING[current_address_index]:
- print 'City\t\t\t-> ok (' + address[CITY][1] + ')'
+ elif address[genivi.CITY][1] == CITY_STRING[current_address_index]:
+ print ('City\t\t\t-> ok (' + address[genivi.CITY][1] + ')')
if STREET_STRING[current_address_index] == '':
test_passed = 1
- elif address[STREET][1] == STREET_STRING[current_address_index]:
- print 'Street\t\t\t-> ok (' + address[STREET][1] + ')'
+ elif address[genivi.STREET][1] == STREET_STRING[current_address_index]:
+ print ('Street\t\t\t-> ok (' + address[genivi.STREET][1] + ')')
if HOUSE_NUMBER_STRING[current_address_index] == '':
test_passed = 1
- elif address[HOUSE_NUMBER][1] == HOUSE_NUMBER_STRING[current_address_index]:
- print 'House number\t-> ok (' + address[HOUSE_NUMBER][1] + ')'
+ elif address[genivi.HOUSE_NUMBER][1] == HOUSE_NUMBER_STRING[current_address_index]:
+ print ('House number\t-> ok (' + address[genivi.HOUSE_NUMBER][1] + ')')
test_passed = 1
if guidable == 1:
if test_passed == 1:
- print 'TEST PASSED'
+ print ('TEST PASSED')
else:
- print 'TEST FAILED (wrong address)'
+ print ('TEST FAILED (wrong address)')
exit()
else:
- print 'TEST FAILED (non-guidable address)'
+ print ('TEST FAILED (non-guidable address)')
exit()
address_index = current_address_index + 1
if address_index < len(COUNTRY_STRING):
startSearch(address_index)
else:
- print 'END OF THE TEST'
+ print ('END OF THE TEST')
exit()
@@ -294,7 +277,7 @@ def evaluate_address(address, guidable):
def search_status_handler(handle,status):
vprint('\n::Search status ' + str(int(status)))
- if status == FINISHED:
+ if status == genivi.FINISHED:
location_input_interface.RequestListUpdate(dbus.UInt32(session_handle), dbus.UInt32(handle),
dbus.UInt16(0),
dbus.UInt16(WINDOW_SIZE))
@@ -312,19 +295,19 @@ def content_updated_handler(handle, guidable, available_selection_criteria, addr
search_mode = -1
- if current_selection_criterion == COUNTRY:
- change_selection_criterion(CITY)
+ if current_selection_criterion == genivi.COUNTRY:
+ change_selection_criterion(genivi.CITY)
target_search_string = CITY_STRING[current_address_index]
search_mode = city_search_mode
- elif current_selection_criterion == CITY:
- change_selection_criterion(STREET)
+ elif current_selection_criterion == genivi.CITY:
+ change_selection_criterion(genivi.STREET)
target_search_string = STREET_STRING[current_address_index]
search_mode = street_search_mode
- elif current_selection_criterion == STREET:
- change_selection_criterion(HOUSE_NUMBER)
+ elif current_selection_criterion == genivi.STREET:
+ change_selection_criterion(genivi.HOUSE_NUMBER)
target_search_string = HOUSE_NUMBER_STRING[current_address_index]
search_mode = house_number_search_mode
- elif current_selection_criterion == HOUSE_NUMBER:
+ elif current_selection_criterion == genivi.HOUSE_NUMBER:
target_search_string = ''
entered_search_string = ''
@@ -336,7 +319,7 @@ def content_updated_handler(handle, guidable, available_selection_criteria, addr
elif search_mode == 1:
full_string_search(handle, target_search_string)
else:
- print '\nTEST FAILED (Invalid search mode)'
+ print ('\nTEST FAILED (Invalid search mode)')
exit()
# Handler for SpellResult callback
@@ -358,7 +341,7 @@ def spell_result_handler(handle, unique_string, valid_characters, full_match):
if len(valid_characters) == 1:
if unicode(valid_characters[0]) == u'\x08':
- print '\nTEST FAILED (Dead end spelling)'
+ print ('\nTEST FAILED (Dead end spelling)')
exit()
if unicode(entered_search_string) == unicode(target_search_string):
@@ -402,7 +385,7 @@ def search_result_list_handler(handle, total_size, window_offset, window_size, r
'\' (Session '+str(int(session_handle)) + ' LocationInputHandle ' + str(int(handle))+')')
location_input_interface.SelectEntry(dbus.UInt32(session_handle), dbus.UInt32(handle), dbus.UInt16(0))
else:
- print '\nTEST FAILED (Unexpected single result list)'
+ print ('\nTEST FAILED (Unexpected single result list)')
exit()
elif spell_next_character == 1:
spell_next_character = 0
@@ -429,8 +412,8 @@ bus.add_signal_receiver(content_updated_handler,
# Timeout
def timeout():
- print 'Timeout Expired'
- print '\nTEST FAILED\n'
+ print ('Timeout Expired')
+ print ('\nTEST FAILED\n')
exit()
def exit():
@@ -456,7 +439,7 @@ def startSearch(address_index):
available_characters = ''
target_search_string = COUNTRY_STRING[current_address_index]
- change_selection_criterion(COUNTRY)
+ change_selection_criterion(genivi.COUNTRY)
if country_search_mode == 0:
spell_search(location_input_handle, entered_search_string, target_search_string, available_characters, 1)
elif country_search_mode == 1:
@@ -470,7 +453,7 @@ session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigatio
# Get SessionHandle
ret = session_interface.CreateSession(dbus.String('test location input'))
session_handle=ret[1]
-print 'Session handle = ' + str(session_handle)
+print ('Session handle = ' + str(session_handle))
location_input_obj = bus.get_object('org.genivi.navigation.navigationcore.LocationInput', '/org/genivi/navigationcore')
location_input_interface = dbus.Interface(location_input_obj, dbus_interface='org.genivi.navigation.navigationcore.LocationInput')
@@ -478,10 +461,10 @@ location_input_interface = dbus.Interface(location_input_obj, dbus_interface='or
# Get LocationInputHandle
ret = location_input_interface.CreateLocationInput(dbus.UInt32(session_handle))
location_input_handle = ret[1]
-print 'LocationInput handle = ' + str(location_input_handle)
+print ('LocationInput handle = ' + str(location_input_handle))
attributes = location_input_interface.GetSupportedAddressAttributes()
-print 'Initially supported address attributes = ' + selection_criteria_array_to_string(attributes)
+print ('Initially supported address attributes = ' + selection_criteria_array_to_string(attributes))
# Configuration
current_address_index = 0
diff --git a/test/navigation/script/test-map-viewer-control.py b/test/navigation/script/test-map-viewer-control.py
index 0c278d4..51ec581 100755
--- a/test/navigation/script/test-map-viewer-control.py
+++ b/test/navigation/script/test-map-viewer-control.py
@@ -33,26 +33,16 @@ import gobject
import dbus.mainloop.glib
import time
from dltTrigger import *
-from xml.dom.minidom import parse
import xml.dom.minidom
import argparse
import sys
import errno
+import genivi
#import pdb; pdb.set_trace()
#name of the test
test_name = "map viewer"
-#constants as defined in the Navigation API
-LATITUDE = 0x00a0
-LONGITUDE = 0x00a1
-MAPVIEWER_MAX = 0x0041
-MAPVIEWER_MIN = 0x0040
-PERSPECTIVE_TWO_D = 0x0020
-PERSPECTIVE_THREE_D = 0x0021
-MAIN_MAP = 0x0010
-SPLIT_SCREEN = 0x0011
-
#constants used by the script
HORIZONTAL_SIZE = 800
VERTICAL_SIZE = 480
@@ -115,7 +105,7 @@ def test_scale(scale,isMinMax):
print('Is min max: '+str(isMinMax))
g_scale=scale
if g_scale_delta==SCALE_DELTA_DECREASE:
- if isMinMax !=MAPVIEWER_MIN:
+ if isMinMax !=genivi.MAPVIEWER_MIN:
print("Zoom in")
MapViewerControl_interface.SetMapViewScaleByDelta( \
dbus.UInt32(sessionhandle), \
@@ -131,7 +121,7 @@ def test_scale(scale,isMinMax):
dbus.Int16(g_scale_delta))
return True
else:
- if isMinMax !=MAPVIEWER_MAX:
+ if isMinMax !=genivi.MAPVIEWER_MAX:
print("Zoom out")
MapViewerControl_interface.SetMapViewScaleByDelta( \
dbus.UInt32(sessionhandle), \
@@ -154,7 +144,7 @@ def test_three_d():
MapViewerControl_interface.SetMapViewPerspective(\
dbus.UInt32(sessionhandle),\
dbus.UInt32(mapviewerhandle), \
- PERSPECTIVE_THREE_D)
+ genivi.PERSPECTIVE_THREE_D)
return False
def mapviewer_mapViewRotated_handler(mapViewInstanceHandle):
@@ -178,7 +168,8 @@ def mapviewer_mapViewScaleChanged_handler(mapViewInstanceHandle,scale,isMinMax):
def mapviewer_mapViewPerspectiveChanged_handler(mapViewInstanceHandle, perspective):
print("Perspective: "+str(perspective))
if step==TEST_STEP_THREE_D:
- if int(perspective)==PERSPECTIVE_THREE_D:
+ if int(perspective)==genivi.PERSPECTIVE_THREE_D:
+ time.sleep(2)
print('Test 3D PASSED')
else:
print('Test 3D failed')
@@ -189,7 +180,6 @@ def timeout():
print ('\nTest FAILED')
exit()
-
def exit():
MapViewerControl_interface.ReleaseMapViewInstance( \
dbus.UInt32(sessionhandle), \
@@ -251,7 +241,6 @@ for location in location_set.getElementsByTagName("location"):
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-
#connect to session bus
bus = dbus.SessionBus()
@@ -290,13 +279,11 @@ MapViewerControl_interface = dbus.Interface(MapViewerControl_obj, dbus_interface
ret = MapViewerControl_interface.CreateMapViewInstance( \
dbus.UInt32(sessionhandle), \
dbus.Struct((dbus.UInt16(HORIZONTAL_SIZE),dbus.UInt16(VERTICAL_SIZE))), \
- dbus.Int32(MAIN_MAP))
+ dbus.Int32(genivi.MAIN_MAP))
mapviewerhandle=ret[1]
print('MapView handle: ' + str(mapviewerhandle))
-time.sleep(2)
-
print ('Stop following the car position')
MapViewerControl_interface.SetFollowCarMode( \
dbus.UInt32(sessionhandle), \
@@ -345,7 +332,7 @@ MapViewerControl_interface.SetMapViewScale( \
time.sleep(0.25)
#init the perspective to 2D
-MapViewerControl_interface.SetMapViewPerspective(dbus.UInt32(sessionhandle),dbus.UInt32(mapviewerhandle), PERSPECTIVE_TWO_D)
+MapViewerControl_interface.SetMapViewPerspective(dbus.UInt32(sessionhandle),dbus.UInt32(mapviewerhandle), genivi.PERSPECTIVE_TWO_D)
#init the heading angle
MapViewerControl_interface.SetCameraHeadingAngle(dbus.UInt32(sessionhandle),dbus.UInt32(mapviewerhandle), dbus.Int32(0))
diff --git a/test/navigation/script/test-poi.py b/test/navigation/script/test-poi.py
index a4b48c7..56628d3 100755
--- a/test/navigation/script/test-poi.py
+++ b/test/navigation/script/test-poi.py
@@ -5,7 +5,7 @@
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
-* \copyright Copyright (C) 2016, PSA GROUP
+* \copyright Copyright (C) 2017, PSA GROUP
*
* \file test-poi.py
*
@@ -28,36 +28,44 @@
import dbus
import gobject
import dbus.mainloop.glib
-import time
-
-import pdb;
-#pdb.set_trace()
from dltTrigger import *
+import xml.dom.minidom
+import argparse
+import sys
+import errno
+import genivi
+#import pdb; pdb.set_trace()
#name of the test
test_name = "poi search"
-#constants as defined in the Navigation API
-GENIVI_Configuration_Settings_LOCALE = 37
-GENIVI_SearchStatusState_FINISHED = 512
-GENIVI_SearchStatusState_NOT_STARTED = 510
-
#constants used into the script
TIME_OUT = 10000
-LATITUDE_PARIS = 48.8578
-LONGITUDE_PARIS = 2.3380
-ALTITUDE_PARIS = 30.0
-ID_HOTEL = 2
-ID_STATION = 6
+ID_FUEL = 256
+ID_HOTEL = 257
+ID_CAR_PARKING = 258
+ID_BAR = 259
+ID_RESTAURANT = 260
ATTRIBUTE_SOURCE = 0
ATTRIBUTE_PHONE = 2
RADIUS_HOTEL = 100 #in tenth of meter !
-RADIUS_STATION = 500
-STRING_TO_SEARCH = "Saint-Germain"
+RADIUS_FUEL = 500
+STRING_TO_SEARCH = "Alpes"
+MAX_WINDOW_SIZE = 100
+OFFSET = 0
+
+# List of coordinates
+LATITUDE = list()
+LONGITUDE = list()
+ALTITUDE = list()
+COUNTRY_STRING = list()
+CITY_STRING = list()
+STREET_STRING = list()
+HOUSE_NUMBER_STRING = list()
def catch_poi_configurationChanged_signal_handler(changedSettings):
for changedSetting in changedSettings:
- if changedSetting == GENIVI_Configuration_Settings_LOCALE:
+ if changedSetting == genivi.LOCALE:
ret=g_poiConfiguration_interface.GetLocale()
print("language: " + ret[0])
print("country: " + ret[1])
@@ -65,9 +73,9 @@ def catch_poi_configurationChanged_signal_handler(changedSettings):
def catch_poi_poiStatus_signal_handler(poiSearchHandle,statusValue):
if poiSearchHandle == g_searchHandle:
- if statusValue == GENIVI_SearchStatusState_FINISHED:
+ if statusValue == genivi.SEARCH_FINISHED:
print("Search finished")
- elif statusValue == GENIVI_SearchStatusState_NOT_STARTED:
+ elif statusValue == genivi.SEARCH_NOT_STARTED:
g_poiSearch_interface.DeletePoiSearchHandle(poiSearchHandle)
print("Test PASSED")
exit()
@@ -75,8 +83,8 @@ def catch_poi_poiStatus_signal_handler(poiSearchHandle,statusValue):
def catch_poi_resultListChanged_signal_handler(poiSearchHandle,resultListSize):
poiList=[]
if poiSearchHandle == g_searchHandle and resultListSize != 0:
- ret=g_poiSearch_interface.RequestResultList(dbus.UInt32(poiSearchHandle),dbus.UInt16(0),dbus.UInt16(resultListSize),[ATTRIBUTE_SOURCE,ATTRIBUTE_PHONE])
- if ret[0] == GENIVI_SearchStatusState_FINISHED and ret[1] >= 0:
+ ret=g_poiSearch_interface.RequestResultList(dbus.UInt32(poiSearchHandle),dbus.UInt16(OFFSET),dbus.UInt16(MAX_WINDOW_SIZE),[ATTRIBUTE_SOURCE,ATTRIBUTE_PHONE])
+ if ret[0] == genivi.SEARCH_FINISHED and ret[1] >= 0:
print("Results: "+str(int(ret[1])))
for result in ret[2]:
poiList.append(result[0])
@@ -84,11 +92,10 @@ def catch_poi_resultListChanged_signal_handler(poiSearchHandle,resultListSize):
for resultDetail in ret:
if resultDetail[1][0] == ID_HOTEL:
print("Hotel: " +resultDetail[0][1])
- elif resultDetail[1][0] == ID_STATION:
- print("Station: " +resultDetail[0][1])
+ elif resultDetail[1][0] == ID_FUEL:
+ print("Fuel: " +resultDetail[0][1])
g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle))
-#timeout
def timeout():
print ('Timeout Expired')
print ('\nTest FAILED')
@@ -98,10 +105,45 @@ def exit():
stopTrigger(test_name)
loop.quit()
+
+print('\n--------------------------')
+print('Poi Test')
+print('--------------------------\n')
+
+parser = argparse.ArgumentParser(description='Poi Test for navigation PoC and FSA.')
+parser.add_argument('-l','--loc',action='store', dest='locations', help='List of locations in xml format')
+parser.add_argument("-v", "--verbose", action='store_true',help='print the whole log messages')
+args = parser.parse_args()
+
+if args.locations == None:
+ print('location file is missing')
+ sys.exit(1)
+else:
+ try:
+ DOMTree = xml.dom.minidom.parse(args.locations)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ print('file not exists')
+ sys.exit(1)
+ location_set = DOMTree.documentElement
+
+print("Area : %s" % location_set.getAttribute("area"))
+
+locations = location_set.getElementsByTagName("location")
+
+for location in location_set.getElementsByTagName("location"):
+ LATITUDE.append(location.getElementsByTagName("latitude")[0].childNodes[0].data)
+ LONGITUDE.append(location.getElementsByTagName("longitude")[0].childNodes[0].data)
+ ALTITUDE.append(0)
+ COUNTRY_STRING.append(location.getElementsByTagName("country")[0].childNodes[0].data)
+ CITY_STRING.append(location.getElementsByTagName("city")[0].childNodes[0].data)
+ STREET_STRING.append(location.getElementsByTagName("street")[0].childNodes[0].data)
+ HOUSE_NUMBER_STRING.append(location.getElementsByTagName("number")[0].childNodes[0].data)
+
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-print("Search for hotel and station with keyword: "+ STRING_TO_SEARCH)
+print("Search for hotel and fuel with keyword: "+ STRING_TO_SEARCH)
#connect to session bus
bus = dbus.SessionBus()
@@ -134,13 +176,13 @@ g_poiConfiguration_interface.SetLocale(dbus.String("fra"),dbus.String("FRA"),dbu
categories=[]
ret=g_poiSearch_interface.GetAvailableCategories()
for categoryAndName in ret:
- if categoryAndName[0] == ID_HOTEL or categoryAndName[0] == ID_STATION:
+ if categoryAndName[0] == ID_HOTEL or categoryAndName[0] == ID_FUEL:
print("Category ID: " + str(int(categoryAndName[0])))
categories.append(categoryAndName[0])
print("Name: " + categoryAndName[1])
attributes_hotel=[]
-attributes_station=[]
+attributes_fuel=[]
attributesDetails=[]
ret=g_poiSearch_interface.GetCategoriesDetails(categories)
for results in ret:
@@ -148,27 +190,29 @@ for results in ret:
for attribute in results[1]:
attributes_hotel.append(attribute[0])
attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_HOTEL),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
- elif results[0][0] == ID_STATION:
+ elif results[0][0] == ID_FUEL:
for attribute in results[1]:
- attributes_station.append(attribute[0])
- attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_STATION),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
+ attributes_fuel.append(attribute[0])
+ attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_FUEL),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
ret=g_poiSearch_interface.GetRootCategory()
g_searchHandle=g_poiSearch_interface.CreatePoiSearchHandle()
print("Search handle: " + str(int(g_searchHandle)))
-lat = LATITUDE_PARIS
-lon = LONGITUDE_PARIS
-alt = ALTITUDE_PARIS
+#init the target (it's the first location in the input file by default) and test
+index=0
+lat = LATITUDE[index]
+lon = LONGITUDE[index]
+alt = ALTITUDE[index]
-g_poiSearch_interface.SetCenter(g_searchHandle,dbus.Struct([lat,lon,alt]))
+g_poiSearch_interface.SetCenter(g_searchHandle,dbus.Struct([dbus.Double(lat),dbus.Double(lon),dbus.Double(alt)]))
-g_poiSearch_interface.SetCategories(g_searchHandle,[dbus.Struct([dbus.UInt32(ID_HOTEL),dbus.UInt32(RADIUS_HOTEL)]),dbus.Struct([dbus.UInt32(ID_STATION),dbus.UInt32(RADIUS_STATION)])])
+g_poiSearch_interface.SetCategories(g_searchHandle,[dbus.Struct([dbus.UInt32(ID_HOTEL),dbus.UInt32(RADIUS_HOTEL)]),dbus.Struct([dbus.UInt32(ID_FUEL),dbus.UInt32(RADIUS_FUEL)])])
g_poiSearch_interface.SetAttributes(g_searchHandle,attributesDetails)
-g_poiSearch_interface.StartPoiSearch(g_searchHandle,dbus.String(STRING_TO_SEARCH),dbus.Int32(1376))
+g_poiSearch_interface.StartPoiSearch(g_searchHandle,dbus.String(STRING_TO_SEARCH),dbus.Int32(genivi.SORT_BY_DISTANCE))
#main loop
diff --git a/test/navigation/script/test-route-calculation.py b/test/navigation/script/test-route-calculation.py
index f0a5221..29dcfd5 100755
--- a/test/navigation/script/test-route-calculation.py
+++ b/test/navigation/script/test-route-calculation.py
@@ -6,6 +6,7 @@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2014, XS Embedded GmbH, PCA Peugeot Citroen
+* \copyright Copyright (C) 2017, PSA GROUP
*
* \file test-route-calculation.py
*
@@ -30,35 +31,17 @@
import dbus
import gobject
import dbus.mainloop.glib
-from collections import namedtuple,defaultdict
-from _dbus_bindings import Int32
-from PIL.GimpGradientFile import SEGMENTS
-from xml.dom.minidom import parse
import xml.dom.minidom
import argparse
import sys
import errno
+import genivi
#import pdb;pdb.set_trace()
-from pip import locations
from dltTrigger import *
#name of the test
test_name = "route calculation"
-#constants as defined in the Navigation API
-GENIVI_NAVIGATIONCORE_LATITUDE = 0x00a0
-GENIVI_NAVIGATIONCORE_LONGITUDE = 0x00a1
-GENIVI_NAVIGATIONCORE_TOTAL_TIME = 0x018e
-GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE = 0x018f
-GENIVI_NAVIGATIONCORE_ROAD_NAME = 0x0147
-GENIVI_NAVIGATIONCORE_START_LATITUDE = 0x0141
-GENIVI_NAVIGATIONCORE_END_LATITUDE = 0x0142
-GENIVI_NAVIGATIONCORE_START_LONGITUDE = 0x0143
-GENIVI_NAVIGATIONCORE_END_LONGITUDE = 0x0144
-GENIVI_NAVIGATIONCORE_DISTANCE = 0x0148
-GENIVI_NAVIGATIONCORE_TIME = 0x0149
-GENIVI_NAVIGATIONCORE_SPEED = 0x00a4
-
#constants used into the script
TIME_OUT = 10000
@@ -100,30 +83,30 @@ bus = dbus.SessionBus()
#add signal receivers
def catchall_route_calculation_signals_handler(routeHandle, status, percentage):
- print 'Route Calculation: ' + str(int(percentage)) + ' %'
+ print ('Route Calculation: ' + str(int(percentage)) + ' %')
if int(percentage) == 100:
#get route overview
- overview = g_routing_interface.GetRouteOverview(dbus.UInt32(g_route_handle),dbus.Array([dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE),dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME)]))
+ overview = g_routing_interface.GetRouteOverview(dbus.UInt32(g_route_handle),dbus.Array([dbus.Int32(genivi.TOTAL_DISTANCE),dbus.Int32(genivi.TOTAL_TIME)]))
#retrieve distance
- totalDistance = dbus.Struct(overview[dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_DISTANCE)])
- print 'Total Distance: ' + str(totalDistance[1]/1000) + ' km'
- totalTime = dbus.Struct(overview[dbus.Int32(GENIVI_NAVIGATIONCORE_TOTAL_TIME)])
+ totalDistance = dbus.Struct(overview[dbus.Int32(genivi.TOTAL_DISTANCE)])
+ print ('Total Distance: ' + str(totalDistance[1]/1000) + ' km')
+ totalTime = dbus.Struct(overview[dbus.Int32(genivi.TOTAL_TIME)])
m, s = divmod(totalTime[1], 60)
h, m = divmod(m, 60)
- print "Total Time: %d:%02d:%02d" % (h, m, s)
+ print ("Total Time: %d:%02d:%02d" % (h, m, s))
#get route segments GetRouteSegments(const uint32_t& routeHandle, const int16_t& detailLevel, const std::vector< DBusCommonAPIEnumeration >& valuesToReturn, const uint32_t& numberOfSegments, const uint32_t& offset, uint32_t& totalNumberOfSegments, std::vector< std::map< DBusCommonAPIEnumeration, DBusCommonAPIVariant > >& routeSegments)
- valuesToReturn = [dbus.Int32(GENIVI_NAVIGATIONCORE_ROAD_NAME),
- dbus.Int32(GENIVI_NAVIGATIONCORE_START_LATITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_END_LATITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_START_LONGITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_END_LONGITUDE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_DISTANCE),
- dbus.Int32(GENIVI_NAVIGATIONCORE_TIME),
- dbus.Int32(GENIVI_NAVIGATIONCORE_SPEED)]
+ valuesToReturn = [dbus.Int32(genivi.ROAD_NAME),
+ dbus.Int32(genivi.START_LATITUDE),
+ dbus.Int32(genivi.END_LATITUDE),
+ dbus.Int32(genivi.START_LONGITUDE),
+ dbus.Int32(genivi.END_LONGITUDE),
+ dbus.Int32(genivi.DISTANCE),
+ dbus.Int32(genivi.TIME),
+ dbus.Int32(genivi.SPEED)]
ret = g_routing_interface.GetRouteSegments(dbus.UInt32(g_route_handle),dbus.Int16(0),dbus.Array(valuesToReturn),dbus.UInt32(500),dbus.UInt32(0))
- print "Total number of segments: " + str(ret[0])
+ print ("Total number of segments: " + str(ret[0]) )
#len(ret[1]) is size
- #ret[1][0][GENIVI_NAVIGATIONCORE_START_LATITUDE] is the start latitude
+ #ret[1][0][genivi.START_LATITUDE] is the start latitude
# pdb.set_trace()
route = g_current_route + 1
if route < routes.length:
@@ -136,9 +119,9 @@ def catchall_route_calculation_signals_handler(routeHandle, status, percentage):
def catchall_session_signals_handler(sessionHandle):
print('Session handle deleted: '+str(sessionHandle))
if sessionHandle == g_session_handle:
- print 'Test PASSED'
+ print ('Test PASSED')
else:
- print 'Test FAILED'
+ print ('Test FAILED')
exit()
def catchall_route_deleted_signals_handler(routeHandle):
@@ -158,8 +141,8 @@ bus.add_signal_receiver(catchall_session_signals_handler, \
#timeout
def timeout():
- print 'Timeout Expired'
- print '\nTest FAILED'
+ print ('Timeout Expired')
+ print ('\nTest FAILED')
exit()
def exit():
@@ -172,24 +155,24 @@ def launch_route_calculation(route):
global g_routing_interface
global g_session_handle
g_current_route = route
- print 'Route name: '+routes[g_current_route].getElementsByTagName("name")[0].childNodes[0].data
+ print ('Route name: '+routes[g_current_route].getElementsByTagName("name")[0].childNodes[0].data)
#get route handle
ret = g_routing_interface.CreateRoute(dbus.UInt32(g_session_handle))
g_route_handle=ret[1]
routes[g_current_route].getElementsByTagName("handle")[0].childNodes[0].data = g_route_handle
- print 'Route handle: ' + str(g_route_handle)
+ print ('Route handle: ' + str(g_route_handle))
start = routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data
dest = routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data
- print 'Calculating route from \
+ print ('Calculating route from \
'+start+'(' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1]) + ') to \
-'+dest+'(' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1]) + ')'
+'+dest+'(' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0]) + ',' + str(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1]) + ')')
#set waypoints
g_routing_interface.SetWaypoints(dbus.UInt32(g_session_handle), \
dbus.UInt32(g_route_handle), \
dbus.Boolean(0), \
dbus.Array([ \
- dbus.Dictionary({dbus.UInt16(GENIVI_NAVIGATIONCORE_LATITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0])]),dbus.UInt16(GENIVI_NAVIGATIONCORE_LONGITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1])])}), \
- dbus.Dictionary({dbus.UInt16(GENIVI_NAVIGATIONCORE_LATITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0])]),dbus.UInt16(GENIVI_NAVIGATIONCORE_LONGITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1])])}) \
+ dbus.Dictionary({dbus.UInt16(genivi.LATITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][0])]),dbus.UInt16(genivi.LONGITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1])])}), \
+ dbus.Dictionary({dbus.UInt16(genivi.LATITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][0])]),dbus.UInt16(genivi.LONGITUDE):dbus.Struct([0,dbus.Double(locations[routes[g_current_route].getElementsByTagName("destination")[0].childNodes[0].data][1])])}) \
]) \
)
#calculate route
@@ -203,7 +186,7 @@ g_session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigat
#get session handle
ret = g_session_interface.CreateSession(dbus.String("test route calculation"))
g_session_handle=ret[1]
-print 'Session handle: ' + str(g_session_handle)
+print ('Session handle: ' + str(g_session_handle))
routing_obj = bus.get_object('org.genivi.navigation.navigationcore.Routing','/org/genivi/navigationcore')
g_routing_interface = dbus.Interface(routing_obj, dbus_interface='org.genivi.navigation.navigationcore.Routing')