From 404ddbd9bb9596270732ec523a8f6d60003ebcf0 Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Thu, 6 Jul 2017 14:57:30 +0200 Subject: improve test scripts and fix an error in guidance --- .../genivi_navigationcore_guidance.cxx | 49 +------ test/navigation/resource/route.xml | 10 +- test/navigation/resource/route_tokyo.xml | 10 +- test/navigation/script/genivi.py | 6 + test/navigation/script/test-guidance.py | 63 +++++--- test/navigation/script/test-map-viewer-control.py | 163 +++++++++++---------- test/navigation/script/test-poi.py | 13 +- 7 files changed, 157 insertions(+), 157 deletions(-) diff --git a/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx b/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx index 94eb39a..42a649a 100644 --- a/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx +++ b/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx @@ -117,9 +117,6 @@ class GuidanceObj std::string m_kind_of_voice; struct item *get_item(struct map_rect *mr); struct map_rect *get_map_rect(void); - void SetSimulationMode(uint32_t SessionHandle, bool Activate); - void GetSimulationMode(bool& SimulationMode); - void SetSimulationSpeed(uint32_t sessionHandle); void PauseGuidance(uint32_t sessionHandle); void ResumeGuidance(uint32_t sessionHandle); void SetVoiceGuidance(const bool& activate, const std::string& voice); @@ -218,28 +215,6 @@ class Guidance m_guidance_active=false; } - void - SetSimulationMode(const uint32_t& SessionHandle, const bool& Activate) - { - dbg(lvl_debug,"enter Activate=%d\n",Activate); - struct attr vehicle; - vehicle.type=attr_vehicle; - vehicle.u.vehicle=get_vehicle(Activate?"enhancedposition:":"demo:"); - if (vehicle.u.vehicle) { - m_simulationMode = Activate; - struct navit *navit=get_navit(); - navit_set_attr(navit, &vehicle); - } else { - dbg(lvl_debug,"Failed to get vehicle\n"); - } - } - - bool - GetSimulationMode() - { - return (m_simulationMode); - } - void StartGuidance(const uint32_t& SessionHandle, const uint32_t& RouteHandle) { @@ -291,20 +266,6 @@ class Guidance return Version; } - void - SetSimulationSpeed(const uint32_t& sessionHandle, const uint8_t& speedFactor) - { - vehicle_speed.u.num=speedFactor*40/4; - if (m_guidance_active==true) - s_guidance->SetSimulationSpeed(sessionHandle); - } - - uint8_t - GetSimulationSpeed() - { - return vehicle_speed.u.num*4/40; - } - void PauseGuidance(const uint32_t& sessionHandle) { @@ -689,14 +650,6 @@ GuidanceObj::GetManeuversList(const uint16_t& requestedNumberOfManeuvers, const map_rect_destroy(mr); } -void -GuidanceObj::SetSimulationSpeed(uint32_t sessionHandle) -{ - struct vehicle *vehicle=get_vehicle("demo:"); - if (vehicle && !m_paused) - vehicle_set_attr(vehicle, &vehicle_speed); -} - void GuidanceObj::PauseGuidance(uint32_t sessionHandle) { @@ -779,7 +732,7 @@ GuidanceObj_Callback(GuidanceObj *obj) dbg(lvl_debug,"level=%d\n",(int) level.u.num); switch(level.u.num) { case 3: - maneuver=GENIVI_NAVIGATIONCORE_CRUISE; + maneuver=GENIVI_NAVIGATIONCORE_PASSED; break; case 2: maneuver=GENIVI_NAVIGATIONCORE_MANEUVER_APPEARED; diff --git a/test/navigation/resource/route.xml b/test/navigation/resource/route.xml index eecf596..9dc7c7b 100644 --- a/test/navigation/resource/route.xml +++ b/test/navigation/resource/route.xml @@ -1,17 +1,17 @@ "Geneve" -"Neuchatel" -"Route GENEVE to NEUCHATEL" +"Carouge" +"Route GENEVE to CAROUGE" 0 46.206659 6.1410842 - -46.990585 -6.928453 + +46.1840286 +6.141048 diff --git a/test/navigation/resource/route_tokyo.xml b/test/navigation/resource/route_tokyo.xml index 439c2bc..32c8e72 100644 --- a/test/navigation/resource/route_tokyo.xml +++ b/test/navigation/resource/route_tokyo.xml @@ -1,13 +1,13 @@ -"Hamura" +"Waseda" "Shibuya" -"Route HAMURA to SHIBUYA" +"Route WASEDA to SHIBUYA" 0 - -35.758795 -139.316533 + +35.709995 +139.666195 35.660687 diff --git a/test/navigation/script/genivi.py b/test/navigation/script/genivi.py index 2b07f82..7c0d301 100644 --- a/test/navigation/script/genivi.py +++ b/test/navigation/script/genivi.py @@ -41,3 +41,9 @@ MAIN_MAP = 0x0010 SPLIT_SCREEN = 0x0011 LOCALE = 0x0025 + +CRUISE = 0x0050 +MANEUVER_APPEARED = 0x0051 +PRE_ADVICE = 0x0052 +ADVICE = 0x0053 +PASSED = 0x0054 diff --git a/test/navigation/script/test-guidance.py b/test/navigation/script/test-guidance.py index 81a3ce5..b8990db 100755 --- a/test/navigation/script/test-guidance.py +++ b/test/navigation/script/test-guidance.py @@ -48,13 +48,13 @@ except dltTriggerNotBuilt: test_name = "guidance" #constants used into the script -TIME_OUT = 20000 +TIME_OUT = 240000 HORIZONTAL_SIZE = 800 VERTICAL_SIZE = 480 MAIN_MAP = 0x0010 NUMBER_OF_SEGMENTS = 500 ZOOM_GUIDANCE = 2 -NUMBER_OF_MANEUVERS_BEFORE_STOP = 5 +SPEED_FACTOR = 16 #add signal receivers def routing_routeCalculationProgressUpdate_handler(routeHandle, status, percentage): @@ -106,6 +106,7 @@ def routing_routeDeleted_handler(routeHandle): def guidance_guidanceStatusChanged_handler(guidanceStatus,routeHandle): global g_guidance_active + global g_total_amount_of_maneuvers print('Guidance status changed: '+str(guidanceStatus)) if guidanceStatus != genivi.ACTIVE and g_guidance_active == True: g_guidance_active = False @@ -116,23 +117,37 @@ def guidance_guidanceStatusChanged_handler(guidanceStatus,routeHandle): for i in range(routes.length): g_routing_interface.DeleteRoute(dbus.UInt32(g_navigationcore_session_handle),dbus.UInt32(routes[i].getElementsByTagName("handle")[0].childNodes[0].data)) g_navigationcore_session_interface.DeleteSession(dbus.UInt32(g_navigationcore_session_handle)) + else: + ret = g_guidance_interface.GetDestinationInformation() + m, s = divmod(ret[1], 60) + h, m = divmod(m, 60) + print ("Travel Time: %d:%02d:%02d" % (h, m, s)) + ret = g_guidance_interface.GetManeuversList(dbus.UInt16(10),dbus.UInt32(0)) + print ("Number of maneuvers: " +str(ret[1])) + print ("Next road to turn: " +ret[2][0][4]) def guidance_positionOnRouteChanged_handler(offsetOnRoute): print ("Offset on route: " +str(offsetOnRoute)) def guidance_maneuverChanged_handler(maneuver): - global g_amount_of_maneuvers - print ("Maneuver: " +str(maneuver)) + if maneuver == genivi.PASSED: + print ("Maneuver passed ") + else: + print ("Maneuver: " +str(maneuver)) ret = g_guidance_interface.GetDestinationInformation() - print ("Travel time: " +str(ret[1])) + m, s = divmod(ret[1], 60) + h, m = divmod(m, 60) + print ("Travel Time: %d:%02d:%02d" % (h, m, s)) 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])) - g_amount_of_maneuvers += 1 - if g_amount_of_maneuvers > NUMBER_OF_MANEUVERS_BEFORE_STOP: - g_mapmatchedposition_interface.SetSimulationMode(dbus.UInt32(g_navigationcore_session_handle),dbus.Boolean(False)) - g_guidance_interface.StopGuidance(dbus.UInt32(g_navigationcore_session_handle)) - + print ("Next road to turn: " +ret[2][0][4]) + +def guidance_waypointReached_handler(isDestination): + print("Waypoint reached: " +str(isDestination)) + if isDestination == 1: + 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)) @@ -141,11 +156,6 @@ def timeout(): print ('Timeout Expired') print ('\nTest FAILED') exit() - -def exit(): - if dltTrigger==True: - stopTrigger(test_name) - loop.quit() def display_route(route): ret = g_routing_interface.GetRouteBoundingBox(dbus.UInt32(g_route_handle)) @@ -168,7 +178,8 @@ def launch_guidance(route): dbus.Double(locations[routes[g_current_route].getElementsByTagName("start")[0].childNodes[0].data][1]),\ dbus.Double(0)\ ))) - g_mapmatchedposition_interface.StartSimulation(g_navigationcore_session_handle) + g_mapmatchedposition_interface.StartSimulation(dbus.UInt32(g_navigationcore_session_handle)) + g_mapmatchedposition_interface.SetSimulationSpeed(dbus.UInt32(g_navigationcore_session_handle), dbus.Byte(SPEED_FACTOR)) def launch_route_calculation(route): global g_current_route @@ -239,10 +250,15 @@ def deleteMapView(): g_mapviewercontrol_interface.ReleaseMapViewInstance( \ dbus.UInt32(g_mapviewer_sessionhandle), \ dbus.UInt32(g_mapviewer_maphandle)) - g_mapviewer_session_interface.DeleteSession(g_mapviewer_sessionhandle) - + +def exit(): + deleteMapView() + if dltTrigger==True: + stopTrigger(test_name) + loop.quit() + print('--------------------------') print('Guidance Test') print('--------------------------') @@ -307,6 +323,10 @@ bus.add_signal_receiver(guidance_maneuverChanged_handler, \ dbus_interface = "org.genivi.navigation.navigationcore.Guidance", \ signal_name = "ManeuverChanged") +bus.add_signal_receiver(guidance_waypointReached_handler, \ + dbus_interface = "org.genivi.navigation.navigationcore.Guidance", \ + signal_name = "WaypointReached") + bus.add_signal_receiver(mapmatchedposition_simulationStatusChanged_handler, \ dbus_interface = "org.genivi.navigation.navigationcore.MapMatchedPosition", \ signal_name = "SimulationStatusChanged") @@ -326,8 +346,8 @@ g_guidance_interface = dbus.Interface(guidance_obj, dbus_interface='org.genivi.n mapviewer_session_obj = bus.get_object('org.genivi.navigation.mapviewer.Session','/org/genivi/mapviewer') g_mapviewer_session_interface = dbus.Interface(mapviewer_session_obj, dbus_interface='org.genivi.navigation.mapviewer.Session') -g_mapviewercontrol_obj = bus.get_object('org.genivi.navigation.mapviewer.MapViewerControl','/org/genivi/mapviewer') -g_mapviewercontrol_interface = dbus.Interface(g_mapviewercontrol_obj, dbus_interface='org.genivi.navigation.mapviewer.MapViewerControl') +mapviewercontrol_obj = bus.get_object('org.genivi.navigation.mapviewer.MapViewerControl','/org/genivi/mapviewer') +g_mapviewercontrol_interface = dbus.Interface(mapviewercontrol_obj, dbus_interface='org.genivi.navigation.mapviewer.MapViewerControl') g_mapmatchedposition_obj = bus.get_object('org.genivi.navigation.navigationcore.MapMatchedPosition','/org/genivi/navigationcore') g_mapmatchedposition_interface = dbus.Interface(g_mapmatchedposition_obj, dbus_interface='org.genivi.navigation.navigationcore.MapMatchedPosition') @@ -341,7 +361,6 @@ createMapView() g_current_route = 0 g_guidance_active = False -g_amount_of_maneuvers = 0 launch_route_calculation(0) #main loop diff --git a/test/navigation/script/test-map-viewer-control.py b/test/navigation/script/test-map-viewer-control.py index 03bb5ff..a20c875 100755 --- a/test/navigation/script/test-map-viewer-control.py +++ b/test/navigation/script/test-map-viewer-control.py @@ -51,6 +51,7 @@ test_name = "map viewer" #constants used by the script HORIZONTAL_SIZE = 800 VERTICAL_SIZE = 480 +MAIN_MAP = 0x0010 TIME_OUT = 1000000 INIT_SCALE=8 SCALE_FOR_ROTATE=4 @@ -76,18 +77,18 @@ HOUSE_NUMBER_STRING = list() def init_test_rotate(): print ('Test rotate') - MapViewerControl_interface.SetMapViewScale( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewScale( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.UInt16(SCALE_FOR_ROTATE)) def test_rotate(): global g_angle if g_angle < (ROTATE_MAX-ROTATE_INCREMENT): g_angle += ROTATE_INCREMENT - MapViewerControl_interface.SetMapViewRotation( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewRotation( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.Int16(g_angle), \ dbus.Int16(ROTATE_SPEED)) return True @@ -97,9 +98,9 @@ def test_rotate(): def init_test_scale(): print ('Test scale') - MapViewerControl_interface.SetMapViewScale( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewScale( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.UInt16(INIT_SCALE)) def test_scale(scale,isMinMax): @@ -112,25 +113,25 @@ def test_scale(scale,isMinMax): if g_scale_delta==SCALE_DELTA_DECREASE: if isMinMax !=genivi.MAPVIEWER_MIN: print("Zoom in") - MapViewerControl_interface.SetMapViewScaleByDelta( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewScaleByDelta( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.Int16(g_scale_delta)) return True else: print("Zoom out") g_scale_delta=SCALE_DELTA_INCREASE - MapViewerControl_interface.SetMapViewScaleByDelta( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewScaleByDelta( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.Int16(g_scale_delta)) return True else: if isMinMax !=genivi.MAPVIEWER_MAX: print("Zoom out") - MapViewerControl_interface.SetMapViewScaleByDelta( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewScaleByDelta( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.Int16(g_scale_delta)) return True else: @@ -140,15 +141,15 @@ def test_scale(scale,isMinMax): def init_test_three_d(): print('Test 3D') - MapViewerControl_interface.SetMapViewScale( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewScale( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.UInt16(SCALE_FOR_THREE_D)) def test_three_d(): - MapViewerControl_interface.SetMapViewPerspective(\ - dbus.UInt32(sessionhandle),\ - dbus.UInt32(mapviewerhandle), \ + g_mapviewercontrol_interface.SetMapViewPerspective(\ + dbus.UInt32(g_mapviewer_sessionhandle),\ + dbus.UInt32(g_mapviewer_maphandle), \ genivi.PERSPECTIVE_THREE_D) return False @@ -185,15 +186,6 @@ def timeout(): print ('\nTest FAILED') exit() -def exit(): - MapViewerControl_interface.ReleaseMapViewInstance( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle)) - session_interface.DeleteSession(sessionhandle) - if dltTrigger==True: - stopTrigger(test_name) - loop.quit() - def next_step(): global step if step == TEST_STEP_START: @@ -210,6 +202,53 @@ def next_step(): else: exit() + +def createMapView(): + global g_mapviewer_sessionhandle + global g_mapviewer_sessionstatus + global g_mapviewer_sessionlist + global g_mapviewer_maphandle + + #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)) + + g_mapviewer_sessionstatus = g_mapviewer_session_interface.GetSessionStatus(dbus.UInt32(g_mapviewer_sessionhandle)); + 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))) + + #get mapviewer handle + ret = g_mapviewercontrol_interface.CreateMapViewInstance( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.Struct((dbus.UInt16(HORIZONTAL_SIZE),dbus.UInt16(VERTICAL_SIZE))), \ + dbus.Int32(MAIN_MAP)) + g_mapviewer_maphandle=ret[1] + + print ('MapView handle: ' + str(g_mapviewer_maphandle)) + + time.sleep(2) + + print ('Stop following the car position') + g_mapviewercontrol_interface.SetFollowCarMode( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ + dbus.Boolean(False)) + +def deleteMapView(): + g_mapviewercontrol_interface.ReleaseMapViewInstance( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle)) + g_mapviewer_session_interface.DeleteSession(g_mapviewer_sessionhandle) + +def exit(): + deleteMapView() + if dltTrigger==True: + stopTrigger(test_name) + loop.quit() + print('\n--------------------------') print('MapViewerControl Test') print('--------------------------\n') @@ -265,37 +304,13 @@ bus.add_signal_receiver(mapviewer_mapViewPerspectiveChanged_handler, \ if dltTrigger==True: startTrigger(test_name) -session = bus.get_object('org.genivi.navigation.mapviewer.Session','/org/genivi/mapviewer') -session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.mapviewer.Session') - -#get session handle -ret = session_interface.CreateSession(dbus.String("test mapviewer")) -sessionhandle=ret[1] -print('Session handle: ' + str(sessionhandle)) - -sessionstatus = session_interface.GetSessionStatus(dbus.UInt32(sessionhandle)); -print ('Session status: ' + str(sessionstatus)) - -sessionlist = session_interface.GetAllSessions(); -print( 'Active sessions = ' + str(len(sessionlist))) - -MapViewerControl_obj = bus.get_object('org.genivi.navigation.mapviewer.MapViewerControl','/org/genivi/mapviewer') -MapViewerControl_interface = dbus.Interface(MapViewerControl_obj, dbus_interface='org.genivi.navigation.mapviewer.MapViewerControl') - -#get mapviewer handle -ret = MapViewerControl_interface.CreateMapViewInstance( \ - dbus.UInt32(sessionhandle), \ - dbus.Struct((dbus.UInt16(HORIZONTAL_SIZE),dbus.UInt16(VERTICAL_SIZE))), \ - dbus.Int32(genivi.MAIN_MAP)) -mapviewerhandle=ret[1] +mapviewer_session_obj = bus.get_object('org.genivi.navigation.mapviewer.Session','/org/genivi/mapviewer') +g_mapviewer_session_interface = dbus.Interface(mapviewer_session_obj, dbus_interface='org.genivi.navigation.mapviewer.Session') -print('MapView handle: ' + str(mapviewerhandle)) +mapviewercontrol_obj = bus.get_object('org.genivi.navigation.mapviewer.MapViewerControl','/org/genivi/mapviewer') +g_mapviewercontrol_interface = dbus.Interface(mapviewercontrol_obj, dbus_interface='org.genivi.navigation.mapviewer.MapViewerControl') -print ('Stop following the car position') -MapViewerControl_interface.SetFollowCarMode( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ - dbus.Boolean(False)) +createMapView() #init the target (it's the first location in the input file by default) and test index=0 @@ -303,12 +318,12 @@ lat1 = LATITUDE[index] lon1 = LONGITUDE[index] alt1 = ALTITUDE[index] print('Set center in '+ CITY_STRING[index]+ ' (' + str(lat1) + ',' + str(lon1) + ')') -MapViewerControl_interface.SetTargetPoint( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ +g_mapviewercontrol_interface.SetTargetPoint( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.Struct((dbus.Double(lat1),dbus.Double(lon1),dbus.Double(alt1)))) -targetPoint = MapViewerControl_interface.GetTargetPoint( \ - dbus.UInt32(mapviewerhandle) ) +targetPoint = g_mapviewercontrol_interface.GetTargetPoint( \ + dbus.UInt32(g_mapviewer_maphandle) ) lat2 = targetPoint[0] lon2 = targetPoint[1] alt2 = targetPoint[2] @@ -324,26 +339,26 @@ if round(float(alt1),4) != round(float(alt2),4) : #init the scale #get the default -ret=MapViewerControl_interface.GetMapViewScale(dbus.UInt32(mapviewerhandle)) +ret=g_mapviewercontrol_interface.GetMapViewScale(dbus.UInt32(g_mapviewer_maphandle)) print('Scale: '+str(int(ret[0]))) print('Is min max: '+str(int(ret[1]))) #and set it to init value g_scale=INIT_SCALE g_scale_delta=SCALE_DELTA_DECREASE -MapViewerControl_interface.SetMapViewScale( \ - dbus.UInt32(sessionhandle), \ - dbus.UInt32(mapviewerhandle), \ +g_mapviewercontrol_interface.SetMapViewScale( \ + dbus.UInt32(g_mapviewer_sessionhandle), \ + dbus.UInt32(g_mapviewer_maphandle), \ dbus.UInt16(g_scale)) #wait for map refresh time.sleep(0.25) #init the perspective to 2D -MapViewerControl_interface.SetMapViewPerspective(dbus.UInt32(sessionhandle),dbus.UInt32(mapviewerhandle), genivi.PERSPECTIVE_TWO_D) +g_mapviewercontrol_interface.SetMapViewPerspective(dbus.UInt32(g_mapviewer_sessionhandle),dbus.UInt32(g_mapviewer_maphandle), genivi.PERSPECTIVE_TWO_D) #init the heading angle -MapViewerControl_interface.SetCameraHeadingAngle(dbus.UInt32(sessionhandle),dbus.UInt32(mapviewerhandle), dbus.Int32(0)) -ret=MapViewerControl_interface.GetCameraHeading(dbus.UInt32(mapviewerhandle)) +g_mapviewercontrol_interface.SetCameraHeadingAngle(dbus.UInt32(g_mapviewer_sessionhandle),dbus.UInt32(g_mapviewer_maphandle), dbus.Int32(0)) +ret=g_mapviewercontrol_interface.GetCameraHeading(dbus.UInt32(g_mapviewer_maphandle)) print('Heading: '+str(int(ret[1]))) g_angle=int(ret[0]) diff --git a/test/navigation/script/test-poi.py b/test/navigation/script/test-poi.py index 7192308..65af596 100755 --- a/test/navigation/script/test-poi.py +++ b/test/navigation/script/test-poi.py @@ -55,7 +55,6 @@ ATTRIBUTE_SOURCE = 0 ATTRIBUTE_PHONE = 2 RADIUS_HOTEL = 100 #in tenth of meter ! RADIUS_RESTAURANT = 500 -STRING_TO_SEARCH = "ZUm" MAX_WINDOW_SIZE = 100 OFFSET = 0 @@ -102,6 +101,7 @@ def catch_poi_resultListChanged_signal_handler(poiSearchHandle,resultListSize): print("Restaurant: " +resultDetail[0][1]) g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle)) else: + print('No poi found') g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle)) def timeout(): @@ -122,8 +122,15 @@ 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') +parser.add_argument('-s','--string',action='store', dest='string', help='String to search') args = parser.parse_args() +if args.string == None: + print('string to search is missing, by default no string, get all') + stringToSearch='' +else: + stringToSearch=args.string + if args.locations == None: print('location file is missing') sys.exit(1) @@ -152,7 +159,7 @@ for location in location_set.getElementsByTagName("location"): if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) -print("Search for hotel and restaurant with keyword: "+ STRING_TO_SEARCH) +print("Search for hotel and restaurant with keyword: "+ stringToSearch) #connect to session bus bus = dbus.SessionBus() @@ -222,7 +229,7 @@ g_poiSearch_interface.SetCategories(g_searchHandle,[dbus.Struct([dbus.UInt32(ID_ g_poiSearch_interface.SetAttributes(g_searchHandle,attributesDetails) -g_poiSearch_interface.StartPoiSearch(g_searchHandle,dbus.String(STRING_TO_SEARCH),dbus.Int32(genivi.SORT_BY_DISTANCE)) +g_poiSearch_interface.StartPoiSearch(g_searchHandle,stringToSearch,dbus.Int32(genivi.SORT_BY_DISTANCE)) #main loop -- cgit v1.2.1