From 64b6cdb911fc26c81fd4c31537c615464df4a96c Mon Sep 17 00:00:00 2001 From: Helmut Schmidt Date: Wed, 4 Nov 2015 09:39:00 +0100 Subject: EnhancedPositionService Configuration interface: extend python test script --- .../dbus/src/configuration.cpp | 8 ++++++-- .../test-scripts/test-configuration-interface.py | 23 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/enhanced-position-service/dbus/src/configuration.cpp b/enhanced-position-service/dbus/src/configuration.cpp index 8af7047..b39eb94 100644 --- a/enhanced-position-service/dbus/src/configuration.cpp +++ b/enhanced-position-service/dbus/src/configuration.cpp @@ -73,8 +73,8 @@ static DBus::Variant variant_array_uint32(std::vector< uint32_t > i) Configuration::Configuration(DBus::Connection &connection, const char * path) : DBus::ObjectAdaptor(connection, path) -, mUpdateInterval(0) -, mSatelliteSystem(0) +, mUpdateInterval(1000) +, mSatelliteSystem(GENIVI_ENHANCEDPOSITIONSERVICE_GPS) { } @@ -132,6 +132,7 @@ std::map< std::string, ::DBus::Variant > Configuration::GetSupportedProperties() std::vector< int32_t > updateIntervals; updateIntervals.push_back(1000); + updateIntervals.push_back(1500); uint32_t supportedSystems; @@ -139,6 +140,9 @@ std::map< std::string, ::DBus::Variant > Configuration::GetSupportedProperties() { //assume GPS at least supportedSystems = GNSS_SYSTEM_GPS; } + + //test hack: add GLONASS to have 2 systems + supportedSystems = supportedSystems|GNSS_SYSTEM_GLONASS; std::vector< uint32_t > satelliteSystems; if (supportedSystems & GNSS_SYSTEM_GPS) diff --git a/enhanced-position-service/dbus/test/test-scripts/test-configuration-interface.py b/enhanced-position-service/dbus/test/test-scripts/test-configuration-interface.py index f35bf92..77f3cbb 100644 --- a/enhanced-position-service/dbus/test/test-scripts/test-configuration-interface.py +++ b/enhanced-position-service/dbus/test/test-scripts/test-configuration-interface.py @@ -79,8 +79,29 @@ enhanced_position = bus.get_object('org.genivi.positioning.EnhancedPosition','/o #get interface enhanced_position_interface = dbus.Interface(enhanced_position, dbus_interface='org.genivi.positioning.Configuration') +#test GetVersion() +version = enhanced_position_interface.GetVersion() +print('Version: {0}.{1}.{2} [{3}]'.format(version[0], version[1], version[2], version[3])) +print('') + +#test GetSupportedProperties() +supported_properties = enhanced_position_interface.GetSupportedProperties() +print('GetSupportedProperties()') +for key in supported_properties: + print('{0}:'.format(key)) + for item in supported_properties[key]: + print(' {0}'.format(item)) +print('') + +#test GetProperties() +properties = enhanced_position_interface.GetProperties() +print('GetProperties()') +print('UpdateInterval: {0}'.format(properties.get('UpdateInterval', 'N/A'))) +print('SatelliteSystem: {0}'.format(properties['SatelliteSystem'])) +print('') + +#test SetProperty() enhanced_position_interface.SetProperty(dbus.String('SatelliteSystem'),dbus.UInt32(SATELLITE_SYSTEM, variant_level=1)) - enhanced_position_interface.SetProperty('UpdateInterval', dbus.Int32(UPDATE_INTERVAL, variant_level=1)) #main loop -- cgit v1.2.1