diff options
Diffstat (limited to 'src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc')
-rw-r--r-- | src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc index 30ea41e0b0..a6dbb2dc71 100644 --- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc @@ -84,6 +84,41 @@ SDLActivateAppRequest::SDLActivateAppRequest( SDLActivateAppRequest::~SDLActivateAppRequest() {} +uint32_t SDLActivateAppRequest::app_id() const { + using namespace strings; + if (!(*message_).keyExists(msg_params)) { + LOG4CXX_DEBUG(logger_, msg_params << " section is absent in the message."); + return 0; + } + if (!(*message_)[msg_params].keyExists(strings::app_id)) { + LOG4CXX_DEBUG(logger_, + strings::app_id << " section is absent in the message."); + return 0; + } + return (*message_)[msg_params][strings::app_id].asUInt(); +} + +#ifdef EXTENDED_PROPRIETARY +void SDLActivateAppRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + using namespace hmi_apis::FunctionID; + + if (application_manager_.state_controller().IsStateActive( + HmiState::STATE_ID_DEACTIVATE_HMI)) { + LOG4CXX_DEBUG(logger_, + "DeactivateHmi state is active. " + "Sends response with result code REJECTED"); + SendErrorResponse(correlation_id(), + static_cast<eType>(function_id()), + hmi_apis::Common_Result::REJECTED); + } else { + const uint32_t application_id = app_id(); + application_manager_.GetPolicyHandler().OnActivateApp(application_id, + correlation_id()); + } +} + +#else // EXTENDED_PROPRIETARY void SDLActivateAppRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace hmi_apis::FunctionID; @@ -160,6 +195,7 @@ void SDLActivateAppRequest::Run() { subscribe_on_event(BasicCommunication_OnAppRegistered); } +#endif // EXTENDED_PROPRIETARY void SDLActivateAppRequest::onTimeOut() { using namespace hmi_apis::FunctionID; using namespace hmi_apis::Common_Result; @@ -192,20 +228,6 @@ void SDLActivateAppRequest::on_event(const event_engine::Event& event) { correlation_id()); } -uint32_t SDLActivateAppRequest::app_id() const { - using namespace strings; - if (!(*message_).keyExists(msg_params)) { - LOG4CXX_DEBUG(logger_, msg_params << " section is absent in the message."); - return 0; - } - if (!(*message_)[msg_params].keyExists(strings::app_id)) { - LOG4CXX_DEBUG(logger_, - strings::app_id << " section is absent in the message."); - return 0; - } - return (*message_)[msg_params][strings::app_id].asUInt(); -} - uint32_t SDLActivateAppRequest::hmi_app_id( const smart_objects::SmartObject& so) const { using namespace strings; |