diff options
-rwxr-xr-x | test/script/fsa-dbusmonitor.sh | 23 | ||||
-rwxr-xr-x | test/script/simulation-dashboard.py | 29 | ||||
-rw-r--r-- | test/script/test-positioning.py | 26 | ||||
-rw-r--r-- | test/script/test-vehicle-info.py | 1 |
4 files changed, 64 insertions, 15 deletions
diff --git a/test/script/fsa-dbusmonitor.sh b/test/script/fsa-dbusmonitor.sh new file mode 100755 index 0000000..3abe4b4 --- /dev/null +++ b/test/script/fsa-dbusmonitor.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +OBJECT1="'org.genivi.positioning.EnhancedPosition'" +INTERFACE1="'org.genivi.positioning.EnhancedPosition'" +DBUSPATH1="'/org/genivi/positioning/EnhancedPosition'" + +OBJECT2="'org.genivi.navigationcore.MapMatchedPosition'" +INTERFACE2="'org.genivi.navigationcore.MapMatchedPosition'" +DBUSPATH2="'/org/genivi/navigationcore'" + +WATCH1="type='signal', sender=${OBJECT1}, interface=${INTERFACE1}, path=${DBUSPATH1}, member='PositionUpdate'" +WATCH2="type='method_call', interface=${INTERFACE1}, path=${DBUSPATH1}, member='GetPositionInfo'" +WATCH3="type='method_call', interface=${INTERFACE2}, path=${DBUSPATH2}, member='GetPosition'" + +dbus-monitor "${WATCH1}" "${WATCH2}" "${WATCH3}" | \ +awk ' +/member='PositionUpdate' && interface=${INTERFACE1} / { print "Position updated by enhanced: "; getline; print "value: " substr($2,1,2) } +/member='GetPositionInfo'/ { print "Get position on enhanced: "; print substr($3,1,20); getline; print "value: " substr($2,1,2) } +/member='PositionUpdate' && interface=${INTERFACE2} / { print "Position updated by map matched: "; getline; print "value: " substr($2,1,2) } +/member='GetPosition'/ { print "Get position on map matched: "; print substr($3,1,20); getline; getline; while (substr($1,1,6) == "uint16") { print "value: " substr($2,1,3); getline} } +' + + diff --git a/test/script/simulation-dashboard.py b/test/script/simulation-dashboard.py index dbe090b..41750d5 100755 --- a/test/script/simulation-dashboard.py +++ b/test/script/simulation-dashboard.py @@ -43,9 +43,9 @@ class Step(IntEnum): END = 4 class Genivi(IntEnum): - ENHANCEDPOSITIONSERVICE_LATITUDE = 0x0020 - ENHANCEDPOSITIONSERVICE_LONGITUDE = 0x0021 - ENHANCEDPOSITIONSERVICE_ALTITUDE = 0x0022 + ENHANCEDPOSITIONSERVICE_LATITUDE = 0x00000001 + ENHANCEDPOSITIONSERVICE_LONGITUDE = 0x00000002 + ENHANCEDPOSITIONSERVICE_ALTITUDE = 0x00000004 FUELSTOPADVISOR_TANK_DISTANCE = 0x0022 FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE = 0x0024 NAVIGATIONCORE_ACTIVE = 0x0060 @@ -105,6 +105,7 @@ def displayStatus(string): display(string,STATUS_LOCATION,WHITE,BLUE) def displayStep(string): + display(' ',STEP_LOCATION,YELLOW,BLACK) display(string,STEP_LOCATION,YELLOW,BLACK) def displayEngineSpeed(string): @@ -245,16 +246,16 @@ def guidanceStatusHandler(status,handle): else: displayGuidanceStatus('---') -def mapMatchedPositionPositionUpdateHandler(arg): - # get the mapmatched position first and check after (to be improved) - mapmatchedPosition = mapMatchedPositionInterface.GetPosition(dbus.Array([Genivi.NAVIGATIONCORE_LATITUDE,Genivi.NAVIGATIONCORE_LONGITUDE])) - for item in arg: - if item==Genivi.NAVIGATIONCORE_LATITUDE: - latitude=float(mapmatchedPosition[dbus.UInt16(Genivi.NAVIGATIONCORE_LATITUDE)]) - displayLatitude("{:.3f}".format(latitude)) - elif item==Genivi.NAVIGATIONCORE_LONGITUDE: - longitude=float(mapmatchedPosition[dbus.UInt16(Genivi.NAVIGATIONCORE_LONGITUDE)]) - displayLongitude("{:.3f}".format(longitude)) +def enhancedPositionPositionUpdateHandler(arg): + time.sleep(.050) + # get the position + enhancedPosition = enhancedPositionInterface.GetPositionInfo(arg) + if (arg & Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE) == Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE: + latitude=float(enhancedPosition[1][dbus.UInt64(Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE)]) + displayLatitude("{:.3f}".format(latitude)) + if (arg & Genivi.ENHANCEDPOSITIONSERVICE_LONGITUDE) == Genivi.ENHANCEDPOSITIONSERVICE_LONGITUDE: + longitude=float(enhancedPosition[1][dbus.UInt64(Genivi.ENHANCEDPOSITIONSERVICE_LONGITUDE)]) + displayLongitude("{:.3f}".format(longitude)) def mapMatchedPositionSimulationStatusHandler(arg): if arg==Genivi.NAVIGATIONCORE_SIMULATION_STATUS_NO_SIMULATION: @@ -344,6 +345,7 @@ except dbus.DBusException: print_exc() sys.exit(1) enhancedPositionInterface = dbus.Interface(enhancedPositionObject, "org.genivi.positioning.EnhancedPosition") +dbusConnectionBus.add_signal_receiver(enhancedPositionPositionUpdateHandler, dbus_interface = "org.genivi.positioning.EnhancedPosition", signal_name = "PositionUpdate") # Guidance try: @@ -364,7 +366,6 @@ except dbus.DBusException: sys.exit(1) mapMatchedPositionInterface = dbus.Interface(mapMatchedPositionObject, "org.genivi.navigationcore.MapMatchedPosition") dbusConnectionBus.add_signal_receiver(mapMatchedPositionSimulationStatusHandler, dbus_interface = "org.genivi.navigationcore.MapMatchedPosition", signal_name = "SimulationStatusChanged") -dbusConnectionBus.add_signal_receiver(mapMatchedPositionPositionUpdateHandler, dbus_interface = "org.genivi.navigationcore.MapMatchedPosition", signal_name = "PositionUpdate") displayStatus( 'Start simulation' ) diff --git a/test/script/test-positioning.py b/test/script/test-positioning.py index 79a2473..50d8cf6 100644 --- a/test/script/test-positioning.py +++ b/test/script/test-positioning.py @@ -102,6 +102,7 @@ def displayStatus(string): display(string,STATUS_LOCATION,WHITE,BLUE) def displayStep(string): + display(' ',STEP_LOCATION,YELLOW,BLACK) display(string,STEP_LOCATION,YELLOW,BLACK) def displayEngineSpeed(string): @@ -194,7 +195,7 @@ def getDbus(): return True def enhancedPositionPositionUpdateHandler(arg): - time.sleep(.100) + time.sleep(.050) # get the position enhancedPosition = enhancedPositionInterface.GetPositionInfo(arg) if (arg & Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE) == Genivi.ENHANCEDPOSITIONSERVICE_LATITUDE: @@ -204,6 +205,18 @@ def enhancedPositionPositionUpdateHandler(arg): longitude=float(enhancedPosition[1][dbus.UInt64(Genivi.ENHANCEDPOSITIONSERVICE_LONGITUDE)]) displayLongitude("{:.3f}".format(longitude)) +def mapMatchedPositionPositionUpdateHandler(arg): + time.sleep(.050) + # get the mapmatched position first and check after (to be improved) + mapmatchedPosition = mapMatchedPositionInterface.GetPosition(dbus.Array([Genivi.NAVIGATIONCORE_LATITUDE,Genivi.NAVIGATIONCORE_LONGITUDE])) + for item in arg: + if item==Genivi.NAVIGATIONCORE_LATITUDE: + latitude=float(mapmatchedPosition[dbus.UInt16(Genivi.NAVIGATIONCORE_LATITUDE)]) + displayLatitude("{:.3f}".format(latitude)) + elif item==Genivi.NAVIGATIONCORE_LONGITUDE: + longitude=float(mapmatchedPosition[dbus.UInt16(Genivi.NAVIGATIONCORE_LONGITUDE)]) + displayLongitude("{:.3f}".format(longitude)) + # Main program begins here parser = argparse.ArgumentParser(description='Test positioning.') parser.add_argument('-v','--ver',action='store_true', help='Print log messages') @@ -248,6 +261,17 @@ except dbus.DBusException: enhancedPositionInterface = dbus.Interface(enhancedPositionObject, "org.genivi.positioning.EnhancedPosition") dbusConnectionBus.add_signal_receiver(enhancedPositionPositionUpdateHandler, dbus_interface = "org.genivi.positioning.EnhancedPosition", signal_name = "PositionUpdate") +# Map matched position +try: + mapMatchedPositionObject = dbusConnectionBus.get_object("org.genivi.navigationcore.MapMatchedPosition","/org/genivi/navigationcore") +except dbus.DBusException: + print ("connection to Map matched position failed") + print_exc() + sys.exit(1) +mapMatchedPositionInterface = dbus.Interface(mapMatchedPositionObject, "org.genivi.navigationcore.MapMatchedPosition") +dbusConnectionBus.add_signal_receiver(mapMatchedPositionPositionUpdateHandler, dbus_interface = "org.genivi.navigationcore.MapMatchedPosition", signal_name = "PositionUpdate") + + displayStatus( 'Start positioning test' ) refresh() diff --git a/test/script/test-vehicle-info.py b/test/script/test-vehicle-info.py index c840c66..e33e82f 100644 --- a/test/script/test-vehicle-info.py +++ b/test/script/test-vehicle-info.py @@ -102,6 +102,7 @@ def displayStatus(string): display(string,STATUS_LOCATION,WHITE,BLUE) def displayStep(string): + display(' ',STEP_LOCATION,YELLOW,BLACK) display(string,STEP_LOCATION,YELLOW,BLACK) def displayEngineSpeed(string): |