diff options
author | AGaliuzov <AGaliuzov@luxoft.com> | 2015-08-31 12:46:03 +0300 |
---|---|---|
committer | AGaliuzov <AGaliuzov@luxoft.com> | 2015-08-31 12:46:03 +0300 |
commit | 12d569a8ae8f8822c3bba13c82f3667780d94250 (patch) | |
tree | 64b10b9d636c786cab47d1641bdd7fedbd13af6e | |
parent | feb79e262c6355a6a7d5b44e301a18bedf2d4160 (diff) | |
parent | f78b241f9678bc4b4dd9200990e1e73781dd1bb2 (diff) | |
download | smartdevicelink-12d569a8ae8f8822c3bba13c82f3667780d94250.tar.gz |
Merge pull request #204 from LuxoftSDL/feature/SDL_and_SW_version_in_RAI
Feature/sdl and sw version in rai
12 files changed, 115 insertions, 33 deletions
diff --git a/customer-specific/pasa/src/appMain/smartDeviceLink.ini b/customer-specific/pasa/src/appMain/smartDeviceLink.ini index fdae45df2..3ceb4a2a7 100644 --- a/customer-specific/pasa/src/appMain/smartDeviceLink.ini +++ b/customer-specific/pasa/src/appMain/smartDeviceLink.ini @@ -21,6 +21,7 @@ VideoStreamingPort = 5050 AudioStreamingPort = 5080 [MAIN] +SDLVersion = {GIT_COMMIT} ; Standard min stack size ; in Ubuntu : PTHREAD_STACK_MIN = 16384 ; in QNX : PTHREAD_STACK_MIN = 256 diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index 560cf46b7..d27a282c2 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -136,21 +136,10 @@ include_directories ( ${CMAKE_SOURCE_DIR}/src/3rd_party/dbus-1.7.8/dbus/ ) -add_custom_target(gitversion - COMMAND export GITVERSION=`git rev-parse HEAD` \; - if ! grep -s \"\$\${GITVERSION}\" ${CMAKE_CURRENT_BINARY_DIR}/gitversion.cc > /dev/null \; - then echo -n \"const char *gitVersion = \\\"Built against \$\${GITVERSION} revision\\\"\;\" > ${CMAKE_CURRENT_BINARY_DIR}/gitversion.cc\; fi - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -) -add_custom_command( - OUTPUT gitversion.cc - DEPENDS gitversion -) set (SOURCES main.cc life_cycle.cc signal_handlers.cc - gitversion.cc ) if( NOT CMAKE_BUILD_TYPE ) @@ -171,6 +160,28 @@ if (CMAKE_SYSTEM_NAME STREQUAL "QNX") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/init_policy.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif () +# Replace commit in ini file +set(GITCOMMIT "") +if(EXISTS ${CMAKE_SOURCE_DIR}/.git) + find_package(Git) + if(GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GITCOMMIT ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(INI_FILE ${CMAKE_CURRENT_BINARY_DIR}/smartDeviceLink.ini) + if(EXISTS ${INI_FILE}) + file(READ ${INI_FILE} FILE_CONTENT) + set(LINE SDLVersion) + set(SEARCH_REGEX "${LINE}([^/\r/\n]+)") + string(REGEX REPLACE "${SEARCH_REGEX}" "${LINE} = ${GITCOMMIT}" + MODIFIED_FILE_CONTENT "${FILE_CONTENT}") + file(WRITE "${INI_FILE}" "${MODIFIED_FILE_CONTENT}") + endif() + endif(GIT_FOUND) +endif() + if (${QT_HMI}) set(main_qml "hmi/MainWindow.qml") set(plugins_dir "hmi/plugins") diff --git a/src/appMain/main.cc b/src/appMain/main.cc index 01b1a792c..f392061c1 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -67,14 +67,12 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "appMain") -extern const char* gitVersion; namespace { const std::string kBrowser = "/usr/bin/chromium-browser"; const std::string kBrowserName = "chromium-browser"; const std::string kBrowserParams = "--auth-schemes=basic,digest,ntlm"; const std::string kLocalHostAddress = "127.0.0.1"; -const std::string kApplicationVersion = "Develop"; #ifdef WEB_HMI /** @@ -123,7 +121,6 @@ int32_t main(int32_t argc, char** argv) { // -------------------------------------------------------------------------- // Logger initialization INIT_LOGGER("log4cxx.properties"); - LOG4CXX_INFO(logger_, gitVersion); #if defined(__QNXNTO__) and defined(GCOV_ENABLED) LOG4CXX_WARN(logger_, "Attention! This application was built with unsupported " @@ -137,7 +134,8 @@ int32_t main(int32_t argc, char** argv) { } LOG4CXX_INFO(logger_, "Application started!"); - LOG4CXX_INFO(logger_, "Application version " << kApplicationVersion); + LOG4CXX_INFO(logger_, "SDL version: " + << profile::Profile::instance()->sdl_version()); // Initialize gstreamer. Needed to activate debug from the command line. #if defined(EXTENDED_MEDIA_MODE) diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index 1c312412c..7626b035e 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -22,6 +22,8 @@ VideoStreamingPort = 5050 AudioStreamingPort = 5080 [MAIN] +SDLVersion = +LogsEnabled = true ; Contains .json/.ini files AppConfigFolder = ; Contains output files, e.g. .wav @@ -81,10 +83,10 @@ RecordingFileSource = audio.8bit.wav ; Recording file for audio pass thru RecordingFileName = audio.wav ; The timeout in seconds for mobile to stop streaming or end up sessions. -StopStreamingTimeout = 1
-; The timeout in miliseconds to suspend audio data streaming if no data received from mobile
-AudioDataStoppedTimeout = 1000
-; The timeout in miliseconds to suspend video data streaming if no data received from mobile
+StopStreamingTimeout = 1 +; The timeout in miliseconds to suspend audio data streaming if no data received from mobile +AudioDataStoppedTimeout = 1000 +; The timeout in miliseconds to suspend video data streaming if no data received from mobile VideoDataStoppedTimeout = 1000 ; HelpPromt and TimeOutPrompt is a vector of strings separated by comma @@ -163,8 +165,8 @@ IAP2SystemConfig = /fs/mp/etc/mm/iap2.cfg IAP2HubConnectAttempts = 3 [ProtocolHandler] -; Packet with payload bigger than next value will be marked as a malformed
-; for protocol v3 or higher
+; Packet with payload bigger than next value will be marked as a malformed +; for protocol v3 or higher ; For v2 protocol MaximumPayloadSize is 1488 MaximumPayloadSize = 131072 ; Application shall send less #FrequencyCount messages per #FrequencyTime mSecs @@ -190,7 +192,7 @@ HashStringSize = 32 [SDL4] ; Enables SDL 4.0 support -EnableProtocol4 = true +EnableProtocol4 = true ; Path where apps icons must be stored AppIconsFolder = storage ; Max size of the folder in bytes diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities.h b/src/components/application_manager/include/application_manager/hmi_capabilities.h index 2ea8cbaf1..277455ff4 100644 --- a/src/components/application_manager/include/application_manager/hmi_capabilities.h +++ b/src/components/application_manager/include/application_manager/hmi_capabilities.h @@ -392,6 +392,20 @@ class HMICapabilities { */ inline bool phone_call_supported() const; + /* + * @brief Interface used to store information about software version of the target + * + * @param ccpu_version Received system/hmi software version + */ + void set_ccpu_version(const std::string& ccpu_version); + + /* + * @brief Returns software version of the target + * + * @return TRUE if it supported, otherwise FALSE + */ + inline const std::string& ccpu_version() const; + protected: /* @@ -458,6 +472,7 @@ class HMICapabilities { smart_objects::SmartObject* prerecorded_speech_; bool is_navigation_supported_; bool is_phone_call_supported_; + std::string ccpu_version_; ApplicationManagerImpl* app_mngr_; @@ -573,6 +588,10 @@ bool HMICapabilities::phone_call_supported() const { return is_phone_call_supported_; } +const std::string& HMICapabilities::ccpu_version() const { + return ccpu_version_; +} + } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_ diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index cb19c66c3..ff8974d1f 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -245,6 +245,8 @@ const char supported_diag_modes[] = "supportedDiagModes"; const char hmi_capabilities[] = "hmiCapabilities"; const char navigation[] = "navigation"; const char phone_call[] = "phoneCall"; +const char sdl_version[] = "sdlVersion"; +const char system_software_version[] = "systemSoftwareVersion"; const char priority[] = "priority"; //resuming diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index b8ba76541..fbe5228a1 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -488,6 +488,9 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( state_ctrl_.ApplyStatesForApp(application); app_list_accesor.Insert(application); + policy::PolicyHandler::instance()->AddApplication( + application->mobile_app_id()); + return application; } @@ -556,6 +559,8 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() { hmi_cooperating_ = true; LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnHMIStartedCooperation()"); + MessageHelper::SendGetSystemInfoRequest(); + utils::SharedPtr<smart_objects::SmartObject> is_vr_ready( MessageHelper::CreateModuleInfoSO( static_cast<uint32_t>(hmi_apis::FunctionID::VR_IsReady))); diff --git a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc index 26b09d06d..5b1ec94e9 100644 --- a/src/components/application_manager/src/commands/hmi/get_system_info_response.cc +++ b/src/components/application_manager/src/commands/hmi/get_system_info_response.cc @@ -30,6 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include "application_manager/commands/hmi/get_system_info_response.h" +#include "application_manager/application_manager_impl.h" #include "application_manager/policies/policy_handler.h" #include "application_manager/message_helper.h" @@ -50,7 +51,23 @@ void GetSystemInfoResponse::Run() { static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); - if (hmi_apis::Common_Result::SUCCESS != code) { + std::string ccpu_version; + std::string wers_country_code; + std::string language; + + if (hmi_apis::Common_Result::SUCCESS == code) { + ccpu_version = + (*message_)[strings::msg_params]["ccpu_version"].asString(); + wers_country_code = + (*message_)[strings::msg_params]["wersCountryCode"].asString(); + uint32_t lang_code = (*message_)[strings::msg_params]["language"].asUInt(); + language = application_manager::MessageHelper::CommonLanguageToString( + static_cast<hmi_apis::Common_Language::eType>(lang_code)); + + HMICapabilities& hmi_capabilities = + ApplicationManagerImpl::instance()->hmi_capabilities(); + hmi_capabilities.set_ccpu_version(ccpu_version); + } else { LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code); // We have to set preloaded flag as false in policy table on any response @@ -61,15 +78,9 @@ void GetSystemInfoResponse::Run() { empty_value); return; } - const std::string ccpu_version = - (*message_)[strings::msg_params]["ccpu_version"].asString(); - const std::string wers_country_code = - (*message_)[strings::msg_params]["wersCountryCode"].asString(); - uint32_t lang_code = (*message_)[strings::msg_params]["language"].asUInt(); - const std::string language = - application_manager::MessageHelper::CommonLanguageToString( - static_cast<hmi_apis::Common_Language::eType>(lang_code)); + // We have to set preloaded flag as false in policy table on any response + // of GetSystemInfo (SDLAQ-CRS-2365) policy::PolicyHandler::instance()->OnGetSystemInfo(ccpu_version, wers_country_code, language); diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index f4edce9fe..11c53f6bd 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -454,6 +454,10 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( hmi_capabilities.navigation_supported(); response_params[strings::hmi_capabilities][strings::phone_call] = hmi_capabilities.phone_call_supported(); + response_params[strings::sdl_version] = + profile::Profile::instance()->sdl_version(); + response_params[strings::system_software_version] = + hmi_capabilities.ccpu_version(); ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller(); std::string hash_id = ""; diff --git a/src/components/application_manager/src/hmi_capabilities.cc b/src/components/application_manager/src/hmi_capabilities.cc index dcf7e9c53..5cdce194a 100644 --- a/src/components/application_manager/src/hmi_capabilities.cc +++ b/src/components/application_manager/src/hmi_capabilities.cc @@ -535,10 +535,15 @@ void HMICapabilities::set_prerecorded_speech( void HMICapabilities::set_navigation_supported(bool supported) { is_navigation_supported_ = supported; } + void HMICapabilities::set_phone_call_supported(bool supported) { is_phone_call_supported_ = supported; } +void HMICapabilities::set_ccpu_version(const std::string& ccpu_version) { + ccpu_version_ = ccpu_version; +} + bool HMICapabilities::load_capabilities_from_file() { std::string json_string; std::string file_name = diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index c372109c2..6a43cafdd 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -58,6 +58,12 @@ class Profile : public utils::Singleton<Profile> { virtual ~Profile(); /** + * @brief Returns sdl version represented + * by git commit or value specified by user + */ + const std::string& sdl_version() const; + + /** * @brief Returns true if HMI should be started, otherwise false */ bool launch_hmi() const; @@ -618,6 +624,7 @@ class Profile : public utils::Singleton<Profile> { bool StringToNumber(const std::string& input, uint64_t& output) const; private: + std::string sdl_version_; bool launch_hmi_; #ifdef WEB_HMI std::string link_to_web_hmi_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 4b6c2b480..700c52fff 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -73,6 +73,7 @@ const char* kProtocolHandlerSection = "ProtocolHandler"; const char* kSDL4Section = "SDL4"; const char* kResumptionSection = "Resumption"; +const char* kSDLVersionKey = "SDLVersion"; const char* kHmiCapabilitiesKey = "HMICapabilities"; const char* kPathToSnapshotKey = "PathToSnapshot"; const char* kPreloadedPTKey = "PreloadedPT"; @@ -165,6 +166,7 @@ const char* kHashStringSizeKey = "HashStringSize"; #ifdef WEB_HMI const char* kDefaultLinkToWebHMI = "HMI/index.html"; #endif // WEB_HMI +const char* kDefaultSDLVersion = ""; const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json"; const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json"; const char* kDefaultPreloadedPTFileName = "sdl_preloaded_pt.json"; @@ -239,7 +241,8 @@ namespace profile { CREATE_LOGGERPTR_GLOBAL(logger_, "Profile") Profile::Profile() - : launch_hmi_(true), + : sdl_version_(kDefaultSDLVersion), + launch_hmi_(true), #ifdef WEB_HMI link_to_web_hmi_(kDefaultLinkToWebHMI), #endif // WEB_HMI @@ -306,8 +309,12 @@ Profile::Profile() attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB), open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB), hash_string_size_(kDefaultHashStringSize) { + ReadStringValue(&sdl_version_, kDefaultSDLVersion, + kMainSection, kSDLVersionKey); } + + Profile::~Profile() { } @@ -322,6 +329,10 @@ const std::string& Profile::config_file_name() const { return config_file_name_; } +const std::string& Profile::sdl_version() const { + return sdl_version_; +} + bool Profile::launch_hmi() const { return launch_hmi_; } @@ -685,6 +696,12 @@ uint16_t Profile::tts_global_properties_timeout() const { void Profile::UpdateValues() { LOG4CXX_AUTO_TRACE(logger_); + // SDL version + ReadStringValue(&sdl_version_, kDefaultSDLVersion, + kMainSection, kSDLVersionKey); + + LOG_UPDATED_VALUE(sdl_version_, kSDLVersionKey, kMainSection); + // Launch HMI parameter std::string launch_value; if (ReadValue(&launch_value, kHmiSection, kLaunchHMIKey) && @@ -1374,7 +1391,7 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE(iap_hub_connection_wait_timeout_, kIAPHubConnectionWaitTimeoutKey, kIAPSection); - + ReadUIntValue(&default_hub_protocol_index_, kDefaultHubProtocolIndex, kIAPSection, kDefaultHubProtocolIndexKey); LOG_UPDATED_VALUE(default_hub_protocol_index_, kDefaultHubProtocolIndexKey, kIAPSection); |