From 4d4b8c024f5983a0fd72ddf496b38ef4848f4404 Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Thu, 1 Jun 2017 15:33:40 +0200 Subject: GT-3509 wrong naming for some signals in Franca (begin with upper case rather than lower case) --- .../navigation/mapviewer/MapViewerControl.fidl | 8 +- .../poiservice/POIContentAccessModule.fidl | 18 +-- src/navigation/CMakeLists.txt | 8 + src/navigation/build.sh | 27 ++-- .../configuration-server-plugin/CMakeLists.txt | 1 + .../mapviewercontrol-server-plugin/CMakeLists.txt | 1 + .../genivi_mapviewer_mapviewercontrol.cxx | 50 +++--- .../session-server-plugin/CMakeLists.txt | 1 + .../configuration-server-plugin/CMakeLists.txt | 1 + .../enhancedposition-client-plugin/CMakeLists.txt | 1 + .../guidance-server-plugin/CMakeLists.txt | 1 + .../locationinput-server-plugin/CMakeLists.txt | 3 +- .../CMakeLists.txt | 1 + .../poicam-server-plugin/CMakeLists.txt | 1 + .../routing-server-plugin/CMakeLists.txt | 1 + .../session-server-plugin/CMakeLists.txt | 1 + .../poi-manager-server/poi-manager-server-stub.cpp | 4 +- .../script-capi/test-map-viewer-control-capi.py | 177 +++++++++++++++------ test/poi-service/poi-manager-client/main.cpp | 34 ++-- test/poi-service/poi-manager-client/run.sh | 2 +- 20 files changed, 219 insertions(+), 122 deletions(-) diff --git a/api/franca/navigation/mapviewer/MapViewerControl.fidl b/api/franca/navigation/mapviewer/MapViewerControl.fidl index f1f678e..d26575c 100755 --- a/api/franca/navigation/mapviewer/MapViewerControl.fidl +++ b/api/franca/navigation/mapviewer/MapViewerControl.fidl @@ -631,9 +631,9 @@ interface MapViewerControl { } <** - @description : CameraHeadingChanged = This signal is emitted when the heading angle of the camera changes + @description : cameraHeadingChanged = This signal is emitted when the heading angle of the camera changes **> - broadcast CameraHeadingChanged { + broadcast cameraHeadingChanged { out { <** @@ -991,9 +991,9 @@ interface MapViewerControl { } <** - @description : MapViewPerspectiveChanged = This signal is emitted when the map perspective chnages + @description : mapViewPerspectiveChanged = This signal is emitted when the map perspective chnages **> - broadcast MapViewPerspectiveChanged { + broadcast mapViewPerspectiveChanged { out { <** diff --git a/api/franca/navigation/poiservice/POIContentAccessModule.fidl b/api/franca/navigation/poiservice/POIContentAccessModule.fidl index a48bde8..0a42c6a 100644 --- a/api/franca/navigation/poiservice/POIContentAccessModule.fidl +++ b/api/franca/navigation/poiservice/POIContentAccessModule.fidl @@ -203,32 +203,32 @@ interface POIContentAccessModule { } } - <** @description : ConfigurationChanged = This signal is sent to the clients when one or more configuration settings changes.**> - broadcast ConfigurationChanged { + <** @description : configurationChanged = This signal is sent to the clients when one or more configuration settings changes.**> + broadcast configurationChanged { out { <** @description : changedSettings array[setting].**> Settings[] changedSettings } } - <** @description : CategoriesRemoved = This signal is emitted when a list of categories and associated content has been removed from the database.**> - broadcast CategoriesRemoved { + <** @description : categoriesRemoved = This signal is emitted when a list of categories and associated content has been removed from the database.**> + broadcast categoriesRemoved { out { <** @description : List of categories removed.**> CategoryID[] categories } } - <** @description : POIAdded = This signal is emitted when a list of POIs and associated content has been added to the database. It returns the ids.**> - broadcast POIAdded { + <** @description : poiAdded = This signal is emitted when a list of POIs and associated content has been added to the database. It returns the ids.**> + broadcast poiAdded { out { <** @description : List of unique ids of POIs added. The order is the same as the order in the AddPOIs method.**> POI_ID[] pois } } - <** @description : POIRemoved = This signal is emitted when a list of POIs and associated content has been removed from the database.**> - broadcast POIRemoved { + <** @description : poiRemoved = This signal is emitted when a list of POIs and associated content has been removed from the database.**> + broadcast poiRemoved { out { <** @description : List of unique ids of POIs removed.**> POI_ID[] pois @@ -236,7 +236,7 @@ interface POIContentAccessModule { } <** @description : SearchStatusChanged = This signal updates the search or proximity alert status of the specified handle.**> - broadcast SearchStatusChanged { + broadcast searchStatusChanged { out { <** @description : poi search unique handle.**> Handle poiSearchHandle diff --git a/src/navigation/CMakeLists.txt b/src/navigation/CMakeLists.txt index 3a8f9ea..547f879 100644 --- a/src/navigation/CMakeLists.txt +++ b/src/navigation/CMakeLists.txt @@ -18,6 +18,7 @@ project(navigation) cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") +find_package(PkgConfig) option(WITH_DBUS_INTERFACE "Build using the D-Bus interfaces" ON) @@ -142,6 +143,13 @@ else() add_subdirectory(${API_DIR}/poi-service "${DBUS_GENERATED_INCLUDE_DIR}/poi-service") endif() +if(${WITH_DLT}) + add_definitions("-DDLT_ENABLED=1") + pkg_check_modules(DLT REQUIRED automotive-dlt) + include_directories( ${DLT_INCLUDE_DIRS} ) + set(LIBRARIES ${LIBRARIES} ${DLT_LIBRARIES}) +endif() + add_subdirectory(navigation-core) add_subdirectory(map-viewer) diff --git a/src/navigation/build.sh b/src/navigation/build.sh index 5ff7bf1..23d5ec5 100755 --- a/src/navigation/build.sh +++ b/src/navigation/build.sh @@ -3,7 +3,8 @@ clean=0 capi=0 navit=0 -commonapi_tools_option="" +dlt_option="-DWITH_DLT=OFF" +commonapi_tools_option="-DWITH_PLUGIN_MIGRATION=OFF" function check_path_for_capi { @@ -28,15 +29,18 @@ function check_path_for_capi echo 'export DBUS_LIB_PATH=' exit 1 fi - commonapi_tools_option="-DDBUS_LIB_PATH="$DBUS_LIB_PATH" -DCOMMONAPI_DBUS_TOOL_DIR="$COMMONAPI_DBUS_TOOL_DIR" -DCOMMONAPI_TOOL_DIR="$COMMONAPI_TOOL_DIR + 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 cmn opt +while getopts cdmn opt do case $opt in c) clean=1 ;; + d) + dlt_option="-DWITH_DLT=ON" + ;; m) capi=1 ;; @@ -45,10 +49,11 @@ do ;; \?) echo "Usage:" - echo "$0 [-cmn]" + echo "$0 [-cdmn]" echo "-c: build with clean" - echo "-m: build with commonAPI plugins " - echo "-n: Build navit" + echo "-d: build with dlt (only with -c)" + echo "-m: build with commonAPI plugins (only with -c) " + echo "-n: build navit" exit 1 esac done @@ -100,15 +105,7 @@ cd ../ echo 'build navigation' if [ "$clean" = 1 ] then - if [ "$capi" = 0 ] - then - cmake -DWITH_PLUGIN_MIGRATION=OFF ../ - else - cmake -DWITH_PLUGIN_MIGRATION=ON -DWITH_DBUS_INTERFACE=OFF $commonapi_tools_option ../ - echo 'fix a bug in the generation of CommonAPI hpp' - sed -i -e 's/(const TimeStampedEnum::/(const ::v4::org::genivi::navigation::navigationcore::NavigationCoreTypes::TimeStampedEnum::/' ./franca/src-gen/v4/org/genivi/navigation/navigationcore/LocationInput.hpp - sed -i -e 's/(const TimeStampedEnum::/(const ::v4::org::genivi::navigation::navigationcore::NavigationCoreTypes::TimeStampedEnum::/' ./franca/src-gen/v4/org/genivi/navigation/navigationcore/MapMatchedPosition.hpp - fi + cmake $dlt_option $commonapi_tools_option ../ echo 'replace a missing font in the configuration file of navit instances' sed -i -e 's/Liberation Sans/TakaoPGothic/' ./navit/navit/navit_genivi_mapviewer.xml sed -i -e 's/Liberation Sans/TakaoPGothic/' ./navit/navit/navit_genivi_navigationcore.xml diff --git a/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt b/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt index 3e31d54..8986abe 100644 --- a/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt +++ b/src/navigation/map-viewer/configuration-server-plugin/CMakeLists.txt @@ -72,6 +72,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt b/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt index 7bc22c8..acaca40 100644 --- a/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt +++ b/src/navigation/map-viewer/mapviewercontrol-server-plugin/CMakeLists.txt @@ -82,6 +82,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/map-viewer/mapviewercontrol-server-plugin/genivi_mapviewer_mapviewercontrol.cxx b/src/navigation/map-viewer/mapviewercontrol-server-plugin/genivi_mapviewer_mapviewercontrol.cxx index c818db1..bbacb2d 100644 --- a/src/navigation/map-viewer/mapviewercontrol-server-plugin/genivi_mapviewer_mapviewercontrol.cxx +++ b/src/navigation/map-viewer/mapviewercontrol-server-plugin/genivi_mapviewer_mapviewercontrol.cxx @@ -65,6 +65,10 @@ #include #include +#include "log.h" + +DLT_DECLARE_CONTEXT(gCtx); + #if (!DEBUG_ENABLED) #undef dbg #define dbg(level,...) ; @@ -1195,13 +1199,11 @@ MapViewerControlObj::SetMapViewScale(NavigationTypes::Handle SessionHandle, uint void MapViewerControlObj::SetMapViewScaleByDelta(NavigationTypes::Handle SessionHandle, int16_t ScaleDelta) { - if (!ScaleDelta) - throw DBus::ErrorInvalidArgs("ScaleDelta must not be 0"); - else { - if (ScaleDelta < 0) - navit_zoom_out(m_navit.u.navit,1 << (-ScaleDelta),NULL); - else navit_zoom_in(m_navit.u.navit,1 << ScaleDelta,NULL); - } + LOG_INFO(gCtx,"Delta=%d",ScaleDelta); + if (ScaleDelta < 0) + navit_zoom_in(m_navit.u.navit,1 << (-ScaleDelta),NULL); + else if (ScaleDelta > 0) + navit_zoom_out(m_navit.u.navit,1 << ScaleDelta,NULL); } void @@ -1209,21 +1211,18 @@ MapViewerControlObj::GetMapViewScale(uint8_t& ScaleID, MapViewerControl::MapScal { struct transformation *trans=navit_get_trans(m_navit.u.navit); long scale=transform_get_scale(trans); - if (scale >= 2097152) - IsMinMax=MapViewerControl::MapScaleType::MAX; - else { - if (scale <= 1) { - IsMinMax=MapViewerControl::MapScaleType::MIN; - } else { + if (scale <= 1) + IsMinMax=MapViewerControl::MapScaleType::MIN; + else + if (scale >= 2097152) + IsMinMax=MapViewerControl::MapScaleType::MAX; + else IsMinMax=MapViewerControl::MapScaleType::MID; - ScaleID=0; - while (scale > 1) { //strange code here, to be investigated ? - scale >>=1; - ScaleID++; - } - } + ScaleID=0; + while (scale > 1) { + scale >>=1; + ScaleID++; } - } void @@ -1973,6 +1972,9 @@ DisplayedRoute::~DisplayedRoute() void plugin_init(void) { + DLT_REGISTER_APP("MPVS","MAP VIEWER CONTROL SERVER"); + DLT_REGISTER_CONTEXT(gCtx,"MPVS","Global Context"); + dbg(lvl_debug,"enter\n"); event_request_system("glib","genivi_mapviewercontrol"); @@ -1991,20 +1993,28 @@ plugin_init(void) successfullyRegistered = runtime->registerService(domain, instanceMapViewerControl, myServiceMapViewerControl); } + LOG_INFO_MSG(gCtx,"map viewer control server"); + //init the session client const std::string instanceNavigationCoreSession = "Session"; mp_navigationCoreSessionClientProxy = new NavigationCoreSessionClientProxy(domain,instanceNavigationCoreSession); + LOG_INFO_MSG(gCtx,"session client"); + //init the routing client const std::string instanceRouting = "Routing"; mp_routingClientProxy = new RoutingClientProxy(domain,instanceRouting); mp_routingClientProxy->setListeners(); + LOG_INFO_MSG(gCtx,"routing client"); + // init the map matched position client const std::string instanceMapMatchedPosition = "MapMatchedPosition"; mp_mapMatchedPositionClientProxy = new MapMatchedPositionClientProxy(domain,instanceMapMatchedPosition); mp_mapMatchedPositionClientProxy->setListeners(); + LOG_INFO_MSG(gCtx,"map matched position client"); + #if LM if (ilm_init() != ILM_SUCCESS) { fprintf(stderr,"error on ilm_init\n"); diff --git a/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt b/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt index df45597..c122f14 100644 --- a/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt +++ b/src/navigation/map-viewer/session-server-plugin/CMakeLists.txt @@ -73,6 +73,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt index 4e35c17..aa16aac 100644 --- a/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/configuration-server-plugin/CMakeLists.txt @@ -72,6 +72,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt b/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt index 4f00710..cdcfb61 100644 --- a/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/enhancedposition-client-plugin/CMakeLists.txt @@ -63,6 +63,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt index 749b82a..6f67649 100644 --- a/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/guidance-server-plugin/CMakeLists.txt @@ -74,6 +74,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt index 20cb3ac..461f8ed 100644 --- a/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/locationinput-server-plugin/CMakeLists.txt @@ -74,9 +74,10 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} + ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} - ${DBUS_LIBRARIES} ${GOBJECT_LIBRARIES} ${GLIB_LIBRARIES} ${DBUS_CPP_GLIB_LIBRARIES} diff --git a/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt index bf5cac5..504cf5d 100644 --- a/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/mapmatchedposition-server-plugin/CMakeLists.txt @@ -74,6 +74,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt index 32ead21..169087d 100644 --- a/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/poicam-server-plugin/CMakeLists.txt @@ -81,6 +81,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt index ea1fbcf..237ec66 100644 --- a/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/routing-server-plugin/CMakeLists.txt @@ -74,6 +74,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} diff --git a/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt b/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt index 5a4931a..9531e2e 100644 --- a/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt +++ b/src/navigation/navigation-core/session-server-plugin/CMakeLists.txt @@ -73,6 +73,7 @@ link_directories( ) set(LIBRARIES + ${LIBRARIES} ${DBUS_LIBRARIES} ${COMMONAPI_LIBRARIES} ${COMMONAPI_DBUS_LIBRARIES} 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 07f4c93..07a917f 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 @@ -1372,7 +1372,7 @@ void PoiManagerServerStub::addPOIs(const std::shared_ptr _c } else { - firePOIAddedEvent(addedPoiList); + firePoiAddedEvent(addedPoiList); } } @@ -1392,7 +1392,7 @@ void PoiManagerServerStub::removePOIs(const std::shared_ptr } else { - firePOIRemovedEvent(_ids); + firePoiRemovedEvent(_ids); } } diff --git a/test/navigation/script-capi/test-map-viewer-control-capi.py b/test/navigation/script-capi/test-map-viewer-control-capi.py index 47da06d..4f70ca8 100755 --- a/test/navigation/script-capi/test-map-viewer-control-capi.py +++ b/test/navigation/script-capi/test-map-viewer-control-capi.py @@ -6,8 +6,9 @@ * SPDX-License-Identifier: MPL-2.0 * * \copyright Copyright (C) 2015, Mentor Graphics +* \copyright Copyright (C) 2017, PSA Group * -* \file test-map-viewer-control.py +* \file test-map-viewer-control-capi.py * * \brief This simple test shows how the mapviewer * could be easily tested using a python script @@ -32,8 +33,12 @@ import gobject import dbus.mainloop.glib import time from dltTrigger import * -#import pdb -#pdb.set_trace() +from xml.dom.minidom import parse +import xml.dom.minidom +import argparse +import sys +import errno +#import pdb; pdb.set_trace() #name of the test test_name = "map viewer" @@ -41,6 +46,8 @@ test_name = "map viewer" #constants as defined in the Navigation API LATITUDE = 0x00a0 LONGITUDE = 0x00a1 +MAPVIEWER_MAX = 0x0041 +MAPVIEWER_MIN = 0x0040 MAIN_MAP = 0x0010 SPLIT_SCREEN = 0x0011 @@ -48,56 +55,123 @@ SPLIT_SCREEN = 0x0011 #constants used by the script HORIZONTAL_SIZE = 800 VERTICAL_SIZE = 480 -TIME_OUT = 10000 -MIN_SCALE = 0 -MAX_SCALE = 21 +TIME_OUT = 20000 +INIT_SCALE=2 +TEST_STEP_START=0 +TEST_STEP_SCALE=1 +TEST_STEP_ROTATE=2 + +# List of coordinates +LATITUDE = list() +LONGITUDE = list() +ALTITUDE = list() +COUNTRY_STRING = list() +CITY_STRING = list() +STREET_STRING = list() +HOUSE_NUMBER_STRING = list() def mapviewer_mapViewScaleChanged_handler(mapViewInstanceHandle,scale,isMinMax): global g_scale + global step new_scale=int(scale) print("Scale: "+str(new_scale)) print('Is min max: '+str(int(isMinMax))) - time.sleep(0.25) - if g_scale > new_scale and new_scale !=MIN_SCALE: - print("Zoom in") - g_scale=new_scale - MapViewerControl_interface.setMapViewScaleByDelta( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ - dbus.Int16(1)) - else: - if new_scale < MAX_SCALE: - print("Zoom out") + if step ==TEST_STEP_SCALE: + time.sleep(0.25) + if g_scale > new_scale and isMinMax !=MAPVIEWER_MIN: + print("Zoom in") g_scale=new_scale MapViewerControl_interface.setMapViewScaleByDelta( \ dbus.UInt32(sessionhandle), \ dbus.UInt32(mapviewerhandle), \ dbus.Int16(-1)) else: - print 'Test PASSED' - MapViewerControl_interface.releaseMapViewInstance( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle)) - session_interface.deleteSession(sessionhandle) - exit() + if isMinMax !=MAPVIEWER_MAX: + print("Zoom out") + g_scale=new_scale + MapViewerControl_interface.setMapViewScaleByDelta( \ + dbus.UInt32(sessionhandle), \ + dbus.UInt32(mapviewerhandle), \ + dbus.Int16(1)) + else: + print('Test scale PASSED') + next_step() #timeout def timeout(): - print 'Timeout Expired' - print '\nTest FAILED' + print('Timeout Expired') + print ('\nTest FAILED') exit() + def exit(): + MapViewerControl_interface.releaseMapViewInstance( \ + dbus.UInt32(sessionhandle), \ + dbus.UInt32(mapviewerhandle)) + session_interface.deleteSession(sessionhandle) stopTrigger(test_name) loop.quit() -print '\n--------------------------' -print 'MapViewerControl Test' -print '--------------------------\n' +def next_step(): + global step + if step == TEST_STEP_START: + step=TEST_STEP_SCALE + print ('Test scale') + MapViewerControl_interface.setMapViewScale( \ + dbus.UInt32(sessionhandle), \ + dbus.UInt32(mapviewerhandle), \ + dbus.UInt16(INIT_SCALE)) + else: + if step ==TEST_STEP_SCALE: + step=TEST_STEP_ROTATE + print ('Test rotate') + MapViewerControl_interface.setMapViewScale( \ + dbus.UInt32(sessionhandle), \ + dbus.UInt32(mapviewerhandle), \ + dbus.UInt16(INIT_SCALE)) + exit() + else: + if step ==TEST_STEP_ROTATE: + exit() + +print('\n--------------------------') +print('MapViewerControl Test') +print('--------------------------\n') + +parser = argparse.ArgumentParser(description='Map Viewer 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) + #connect to session bus bus = dbus.SessionBus() @@ -105,21 +179,22 @@ bus.add_signal_receiver(mapviewer_mapViewScaleChanged_handler, \ dbus_interface = "org.genivi.navigation.mapviewer.MapViewerControl.v4_0", \ signal_name = "mapViewScaleChanged") + startTrigger(test_name) session = bus.get_object('org.genivi.navigation.mapviewer.Session.v4_0_Session','/Session') session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.mapviewer.Session.v4_0') #get session handle -ret = session_interface.createSession(dbus.String('test mapviewer')) +ret = session_interface.createSession(dbus.String("test mapviewer")) sessionhandle=ret[1] -print 'Session handle: ' + str(sessionhandle) +print('Session handle: ' + str(sessionhandle)) sessionstatus = session_interface.getSessionStatus(dbus.UInt32(sessionhandle)); -print 'Session status: ' + str(sessionstatus) +print ('Session status: ' + str(sessionstatus)) sessionlist = session_interface.getAllSessions(); -print 'Active sessions = ' + str(len(sessionlist)) +print( 'Active sessions = ' + str(len(sessionlist))) MapViewerControl_obj = bus.get_object('org.genivi.navigation.mapviewer.MapViewerControl.v4_0_MapViewerControl','/MapViewerControl') MapViewerControl_interface = dbus.Interface(MapViewerControl_obj, dbus_interface='org.genivi.navigation.mapviewer.MapViewerControl.v4_0') @@ -131,22 +206,23 @@ ret = MapViewerControl_interface.createMapViewInstance( \ dbus.Int32(MAIN_MAP)) mapviewerhandle=ret[1] -print 'MapView handle: ' + str(mapviewerhandle) +print('MapView handle: ' + str(mapviewerhandle)) -# Bern -lat1 = 46.9479 -lon1 = 7.4446 -alt1 = 0 +index=0 + +lat1 = LATITUDE[index] +lon1 = LONGITUDE[index] +alt1 = ALTITUDE[index] time.sleep(2) -print 'Stop following the car position' +print ('Stop following the car position') MapViewerControl_interface.setFollowCarMode( \ dbus.UInt32(sessionhandle), \ dbus.UInt32(mapviewerhandle), \ dbus.Boolean(False)) -print 'Set center in Bern(' + str(lat1) + ',' + str(lon1) + ')' +print('Set center in '+ CITY_STRING[index]+ ' (' + str(lat1) + ',' + str(lon1) + ')') MapViewerControl_interface.setTargetPoint( \ dbus.UInt32(sessionhandle), \ dbus.UInt32(mapviewerhandle), \ @@ -160,16 +236,16 @@ lat2 = targetPoint[0] lon2 = targetPoint[1] alt2 = targetPoint[2] -print 'Get center -> (' + str(lat2) + ',' + str(lon2) + ')' +print ('Get center -> (' + str(lat2) + ',' + str(lon2) + ')' ) -if round(lat1,4) != round(lat2,4) : - print '\nTest Failed:' + str(round(lat1,4)) + '!=' + str(round(lat2,4)) + '\n' +if round(float(lat1),4) != round(float(lat2),4) : + print ('\nTest Failed:' + str(round(float(lat1),4)) + '!=' + str(round(float(lat2),4)) + '\n' ) -if round(lon1,4) != round(lon2,4) : - print '\nTest Failed:' + str(round(lon1,4)) + '!=' + str(round(lon2,4)) + '\n' +if round(float(lon1),4) != round(float(lon2),4) : + print('\nTest Failed:' + str(round(float(lon1),4)) + '!=' + str(round(float(lon2),4)) + '\n' ) -if round(alt1,4) != round(alt2,4) : - print '\nTest Failed:' + str(round(alt1,4)) + '!=' + str(round(alt2,4)) + '\n' +if round(float(alt1),4) != round(float(alt2),4) : + print('\nTest Failed:' + str(round(float(alt1),4)) + '!=' + str(round(float(alt2),4)) + '\n') ret=MapViewerControl_interface.getMapViewScale(dbus.UInt32(mapviewerhandle)) print('Scale: '+str(int(ret[0]))) @@ -177,16 +253,11 @@ print('Is min max: '+str(int(ret[1]))) g_scale=int(ret[0]) -time.sleep(0.25) - -print 'Zoom in' -MapViewerControl_interface.setMapViewScaleByDelta(dbus.UInt32(sessionhandle), dbus.UInt32(mapviewerhandle), dbus.Int16(1)) +step=TEST_STEP_START +next_step() #main loop gobject.timeout_add(TIME_OUT, timeout) loop = gobject.MainLoop() loop.run() - - - diff --git a/test/poi-service/poi-manager-client/main.cpp b/test/poi-service/poi-manager-client/main.cpp index 1ed3833..6ace120 100644 --- a/test/poi-service/poi-manager-client/main.cpp +++ b/test/poi-service/poi-manager-client/main.cpp @@ -64,15 +64,15 @@ public: void getServerStatus(); - void ConfigurationChanged(const std::vector &changedSettings); + void configurationChanged(const std::vector &changedSettings); - void CategoriesRemoved(const std::vector< CommonTypes::CategoryID >& categories); + void categoriesRemoved(const std::vector< CommonTypes::CategoryID >& categories); - void POIAdded(const std::vector< POIServiceTypes::POI_ID >& pois); + void poiAdded(const std::vector< POIServiceTypes::POI_ID >& pois); - void POIRemoved(const std::vector< POIServiceTypes::POI_ID >& pois); + void poiRemoved(const std::vector< POIServiceTypes::POI_ID >& pois); - void SearchStatusChanged(const NavigationTypes::Handle &handle, const POIServiceTypes::SearchStatusState &searchStatusState, const std::vector &pois); + void searchStatusChanged(const NavigationTypes::Handle &handle, const POIServiceTypes::SearchStatusState &searchStatusState, const std::vector &pois); void connectPopupWindow(GtkWidget *window); @@ -236,7 +236,7 @@ void contentManager::getServerStatus() } -void contentManager::ConfigurationChanged(const std::vector< POIServiceTypes::Settings >& changedSettings) +void contentManager::configurationChanged(const std::vector< POIServiceTypes::Settings >& changedSettings) { size_t index; @@ -248,7 +248,7 @@ void contentManager::ConfigurationChanged(const std::vector< POIServiceTypes::Se } } -void contentManager::CategoriesRemoved(const std::vector &categories) +void contentManager::categoriesRemoved(const std::vector &categories) { size_t index; @@ -264,7 +264,7 @@ void contentManager::CategoriesRemoved(const std::vector &pois) +void contentManager::poiAdded(const std::vector &pois) { size_t index; @@ -276,7 +276,7 @@ void contentManager::POIAdded(const std::vector &pois) } } -void contentManager::POIRemoved(const std::vector &pois) +void contentManager::poiRemoved(const std::vector &pois) { size_t index; @@ -287,7 +287,7 @@ void contentManager::POIRemoved(const std::vector &pois } -void contentManager::SearchStatusChanged(const NavigationTypes::Handle &handle, const POIServiceTypes::SearchStatusState &searchStatusState, const std::vector &pois) +void contentManager::searchStatusChanged(const NavigationTypes::Handle &handle, const POIServiceTypes::SearchStatusState &searchStatusState, const std::vector &pois) { size_t index; @@ -639,19 +639,19 @@ int main(int argc , char** argv ) // Connect the DBus signals myProxy->getCategoriesRemovedEvent().subscribe([&](const std::vector& categories) { - clientContentManager->CategoriesRemoved(categories); + clientContentManager->categoriesRemoved(categories); }); myProxy->getConfigurationChangedEvent().subscribe([&](const std::vector< POIServiceTypes::Settings >& changedSettings) { - clientContentManager->ConfigurationChanged(changedSettings); + clientContentManager->configurationChanged(changedSettings); }); - myProxy->getPOIAddedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) { - clientContentManager->POIAdded(pois); + myProxy->getPoiAddedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) { + clientContentManager->poiAdded(pois); }); - myProxy->getPOIRemovedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) { - clientContentManager->POIRemoved(pois); + myProxy->getPoiRemovedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) { + clientContentManager->poiRemoved(pois); }); myProxy->getSearchStatusChangedEvent().subscribe([&](const NavigationTypes::Handle handle, const POIServiceTypes::SearchStatusState searchStatusState, const std::vector< POIServiceTypes::POI_ID >& pois ) { - clientContentManager->SearchStatusChanged(handle,searchStatusState,pois); + clientContentManager->searchStatusChanged(handle,searchStatusState,pois); }); // Send a feedback to the user diff --git a/test/poi-service/poi-manager-client/run.sh b/test/poi-service/poi-manager-client/run.sh index f978a93..215647d 100755 --- a/test/poi-service/poi-manager-client/run.sh +++ b/test/poi-service/poi-manager-client/run.sh @@ -37,7 +37,7 @@ echo '------------------------start the proof of concept------------------------ cp $RESOURCE/poi-database-managed.db ./bin COMMONAPI_DEFAULT_CONFIG=$RESOURCE/commonapi4dbus.ini \ COMMONAPI_DBUS_DEFAULT_CONFIG=$RESOURCE/commonapi-dbus.ini \ -$POI_MANAGER_SERVER_BIN_DIR/poi-manager-server -f $POI_MANAGER_SERVER_BIN_DIR/poi-database-managed.db & +$POI_MANAGER_SERVER_BIN_DIR/poi-manager-server -f $POI_MANAGER_CLIENT_BIN_DIR/poi-database-managed.db & COMMONAPI_DEFAULT_CONFIG=$RESOURCE/commonapi4dbus.ini \ COMMONAPI_DBUS_DEFAULT_CONFIG=$RESOURCE/commonapi-dbus.ini \ $POI_MANAGER_CLIENT_BIN_DIR/poi-manager-client -t -- cgit v1.2.1