summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr Galiuzov (GutHub) <AGaliuzov@luxoft.com>2016-08-17 10:28:11 +0300
committerGitHub <noreply@github.com>2016-08-17 10:28:11 +0300
commit77d515216506694c650ee660baa4b9431398d235 (patch)
tree987ef78f034fa3bd4af876ad04b418d99a675e46
parent834649fad910ca71f9f2ceba6a851cea0fecf6ed (diff)
parent9df2535e17ac5a423c534fda11316e21289caa4f (diff)
downloadsdl_core-77d515216506694c650ee660baa4b9431398d235.tar.gz
Merge pull request #760 from LuxoftAKutsan/feature/SDL_behaviour_if_VR_not_avaliable
SDL behaviour if VR not available
-rw-r--r--src/components/application_manager/include/application_manager/application_manager.h8
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h7
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h24
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h9
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h17
-rw-r--r--src/components/application_manager/include/application_manager/hmi_interfaces.h96
-rw-r--r--src/components/application_manager/include/application_manager/hmi_interfaces_impl.h78
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h2
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc76
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc6
-rw-r--r--src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc77
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc98
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_request.cc119
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc264
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc274
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc45
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application_manager.h1
-rw-r--r--src/components/include/security_manager/crypto_manager.h2
-rw-r--r--src/components/utils/include/utils/helpers.h9
24 files changed, 982 insertions, 258 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager.h b/src/components/application_manager/include/application_manager/application_manager.h
index 214f101b40..99e152a82b 100644
--- a/src/components/application_manager/include/application_manager/application_manager.h
+++ b/src/components/application_manager/include/application_manager/application_manager.h
@@ -47,6 +47,7 @@
#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/application_manager_settings.h"
#include "application_manager/state_controller.h"
+#include "application_manager/hmi_interfaces.h"
namespace resumption {
class LastState;
@@ -494,6 +495,13 @@ class ApplicationManager {
virtual resumption::ResumeCtrl& resume_controller() = 0;
+ /**
+ * @brief hmi_interfaces getter for hmi_interfaces component, that handle
+ * hmi_instrfaces state
+ * @return reference to hmi_interfaces component
+ */
+ virtual HmiInterfaces& hmi_interfaces() = 0;
+
virtual app_launch::AppLaunchCtrl& app_launch_ctrl() = 0;
/*
* @brief Converts connection string transport type representation
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 2775c6ad5d..bb064d8b61 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -53,6 +53,7 @@
#include "application_manager/app_launch/app_launch_data.h"
#include "application_manager/application_manager_settings.h"
#include "application_manager/event_engine/event_dispatcher_impl.h"
+#include "application_manager/hmi_interfaces_impl.h"
#include "protocol_handler/protocol_observer.h"
#include "protocol_handler/protocol_handler.h"
@@ -844,6 +845,10 @@ class ApplicationManagerImpl
return *resume_ctrl_.get();
}
+ HmiInterfaces& hmi_interfaces() OVERRIDE {
+ return hmi_interfaces_;
+ }
+
/**
* Generate grammar ID
*
@@ -1424,6 +1429,8 @@ class ApplicationManagerImpl
*/
std::auto_ptr<resumption::ResumeCtrl> resume_ctrl_;
+ HmiInterfacesImpl hmi_interfaces_;
+
NaviServiceStatusMap navi_service_status_;
std::deque<uint32_t> navi_app_to_stop_;
std::deque<uint32_t> navi_app_to_end_stream_;
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index c5f45e2095..8a00764ca3 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -182,6 +182,10 @@ class CommandRequestImpl : public CommandImpl,
*/
void AddDisallowedParametersToInfo(
smart_objects::SmartObject& response) const;
+
+ bool ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h
index 22a0c7e85f..5ee7b74239 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/add_command_request.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ADD_COMMAND_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_ADD_COMMAND_REQUEST_H_
+#include <string>
#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
@@ -141,6 +142,7 @@ class AddCommandRequest : public CommandRequestImpl {
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType vr_result_;
+ std::string info_;
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
index 2a6e55f312..d20fa393b1 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
@@ -231,6 +231,30 @@ class CreateInteractionChoiceSetRequest : public CommandRequestImpl {
*/
bool IsWhiteSpaceExist(const smart_objects::SmartObject& choice_set);
+ /**
+ * @brief ProcessHmiError process received error from HMI.
+ * This function id not thread safe. It should be protected with
+ * vr_commands_lock_
+ * @param vr_result ERROR type
+ */
+ void ProcessHmiError(const hmi_apis::Common_Result::eType vr_result);
+
+ /**
+ * @brief ProcessSuccesfulHMIResponse process succesful response from HMI\
+ * This function id not thread safe. It should be protected with
+ * vr_commands_lock_
+ * @param corr_id correlation id of received response
+ * @return true if resuest with corr_itd was sent on HMI, false otherwise
+ */
+ bool ProcessSuccesfulHMIResponse(const uint32_t corr_id);
+
+ /**
+ * @brief CountReceivedVRResponses counts received HMI responses. Updated
+ * request timeout if not all responses received
+ * Send response to mobile if all responses received.
+ */
+ void CountReceivedVRResponses();
+
DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h
index 6a19014c96..70fd8f3742 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/delete_command_request.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_DELETE_COMMAND_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_DELETE_COMMAND_REQUEST_H_
+#include <string>
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
@@ -81,6 +82,13 @@ class DeleteCommandRequest : public CommandRequestImpl {
*/
bool IsPendingResponseExist();
+ /**
+ * @brief CalculateResult calculate mobile result from received ui and vr
+ * results
+ * @return calculated mobile result
+ */
+ bool CalculateResult();
+
bool is_ui_send_;
bool is_vr_send_;
@@ -89,6 +97,7 @@ class DeleteCommandRequest : public CommandRequestImpl {
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType vr_result_;
+ std::string info_;
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
index 7c766a94af..507f8f9bed 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
@@ -87,6 +87,23 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
private:
/**
+ * @brief SendChangeRegistration send ChangeRegistration on HMI
+ * @param function_id interface specific ChangeRegistration
+ * @param language language of registration
+ * @param app_id application to change registration
+ */
+ void SendChangeRegistration(const hmi_apis::FunctionID::eType function_id,
+ const int32_t language,
+ const uint32_t app_id);
+
+ /**
+ * @brief SendChangeRagistrationOnHMI send required SendChangeRagistration
+ * HMI
+ * @param app application to change registration
+ */
+ void SendChangeRagistrationOnHMI(ApplicationConstSharedPtr app);
+
+ /**
* @brief Sends OnAppRegistered notification to HMI
*
*@param application_impl application with changed HMI status
diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces.h b/src/components/application_manager/include/application_manager/hmi_interfaces.h
new file mode 100644
index 0000000000..4f73c75fcb
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/hmi_interfaces.h
@@ -0,0 +1,96 @@
+/*
+
+ Copyright (c) 2016, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_H_
+
+#include "interfaces/HMI_API.h"
+
+namespace application_manager {
+
+/**
+ * @brief The HmiInterfacesImpl class handles
+ * hmi interfaces states
+ */
+class HmiInterfaces {
+ public:
+ enum InterfaceID {
+ HMI_INTERFACE_INVALID_ENUM,
+ HMI_INTERFACE_Buttons,
+ HMI_INTERFACE_BasicCommunication,
+ HMI_INTERFACE_VR,
+ HMI_INTERFACE_TTS,
+ HMI_INTERFACE_UI,
+ HMI_INTERFACE_Navigation,
+ HMI_INTERFACE_VehicleInfo,
+ HMI_INTERFACE_SDL
+ };
+
+ /**
+ * @brief The InterfaceState enum handle possible states of HMI interfaces
+ * STATE_NOT_RESPONSE - HMI didn't not responsed IsReady on Inerface
+ * STATE_AVAILABLE - Hmi responsed IsReady(avaliable = true)
+ * STATE_NOT_AVAILABLE - Hmi responsed IsReady(avaliable = false)
+ */
+ enum InterfaceState {
+ STATE_NOT_RESPONSE,
+ STATE_AVAILABLE,
+ STATE_NOT_AVAILABLE
+ };
+
+ /**
+ * @brief GetInterfaceState return currecnt state of hmi interface
+ * @param interface to get state
+ * @return state of interface
+ */
+ virtual InterfaceState GetInterfaceState(InterfaceID interface) const = 0;
+
+ /**
+ * @brief SetInterfaceState set interface to some state
+ * @param interface interface to set state
+ * @param state to setup
+ */
+ virtual InterfaceID GetInterfaceFromFunction(
+ hmi_apis::FunctionID::eType function) const = 0;
+
+ /**
+ * @brief GetInterfaceFromFunction extract interface name fron function id
+ * @param function to extract interface name
+ * @return extracted interface name
+ */
+ virtual void SetInterfaceState(InterfaceID interface,
+ InterfaceState state) = 0;
+ virtual ~HmiInterfaces() {}
+};
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_H_
diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h b/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h
new file mode 100644
index 0000000000..c6703db87e
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_IMPL_H_
+#include <map>
+#include "application_manager/hmi_interfaces.h"
+#include "utils/macro.h"
+#include "utils/lock.h"
+
+namespace application_manager {
+
+/**
+ * @brief The HmiInterfacesImpl class handles
+ * hmi interfaces states
+ */
+class HmiInterfacesImpl : public HmiInterfaces {
+ public:
+ HmiInterfacesImpl();
+
+ /**
+ * @brief GetInterfaceState return currecnt state of hmi interface
+ * @param interface to get state
+ * @return state of interface
+ */
+ InterfaceState GetInterfaceState(InterfaceID interface) const OVERRIDE;
+
+ /**
+ * @brief SetInterfaceState set interface to some state
+ * @param interface interface to set state
+ * @param state to setup
+ */
+ void SetInterfaceState(InterfaceID interface, InterfaceState state) OVERRIDE;
+
+ /**
+ * @brief GetInterfaceFromFunction extract interface name fron function id
+ * @param function to extract interface name
+ * @return extracted interface name
+ */
+ InterfaceID GetInterfaceFromFunction(
+ hmi_apis::FunctionID::eType function) const OVERRIDE;
+
+ private:
+ typedef std::map<InterfaceID, InterfaceState> InterfaceStatesMap;
+ InterfaceStatesMap interfaces_states_;
+ mutable sync_primitives::Lock interfaces_states_lock_;
+};
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index ab89883ad2..a423ea7507 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -269,8 +269,6 @@ class MessageHelper {
*/
static void SendUIChangeRegistrationRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
- static void SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app,
- ApplicationManager& app_mngr);
static void SendAddVRCommandToHMI(
uint32_t cmd_id,
const smart_objects::SmartObject& vr_commands,
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index b3b463328f..dcb291dbd9 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -32,6 +32,7 @@
#include <algorithm>
#include <string>
+#include "utils/macro.h"
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
@@ -194,6 +195,59 @@ bool CommandRequestImpl::CheckSyntax(const std::string& str,
return true;
}
+smart_objects::SmartObject CreateUnsupportedResourceResponse(
+ const hmi_apis::FunctionID::eType function_id,
+ const uint32_t hmi_correlation_id,
+ HmiInterfaces::InterfaceID interface) {
+ smart_objects::SmartObject response(smart_objects::SmartType_Map);
+ smart_objects::SmartObject& params = response[strings::params];
+ params[strings::message_type] = MessageType::kResponse;
+ params[strings::correlation_id] = hmi_correlation_id;
+ params[strings::protocol_type] = CommandImpl::hmi_protocol_type_;
+ params[strings::protocol_version] = CommandImpl::protocol_version_;
+ params[strings::function_id] = function_id;
+ params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
+ smart_objects::SmartObject& msg_params = response[strings::msg_params];
+
+ switch (interface) {
+ case HmiInterfaces::HMI_INTERFACE_VR: {
+ msg_params[strings::info] = "VR is not supported by system";
+ break;
+ }
+ case HmiInterfaces::HMI_INTERFACE_VehicleInfo: {
+ msg_params[strings::info] = "VehicleInfo is not supported by system";
+ break;
+ }
+ case HmiInterfaces::HMI_INTERFACE_UI: {
+ msg_params[strings::info] = "UI is not supported by system";
+ break;
+ }
+ default:
+ break;
+ }
+ return response;
+}
+
+bool CommandRequestImpl::ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ HmiInterfaces::InterfaceID interface =
+ hmi_interfaces.GetInterfaceFromFunction(function_id);
+ DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM);
+ const HmiInterfaces::InterfaceState state =
+ hmi_interfaces.GetInterfaceState(interface);
+ if (HmiInterfaces::STATE_NOT_AVAILABLE == state) {
+ event_engine::Event event(function_id);
+ event.set_smart_object(CreateUnsupportedResourceResponse(
+ function_id, hmi_correlation_id, interface));
+ event.raise(application_manager_.event_dispatcher());
+ return false;
+ }
+ return true;
+}
+
uint32_t CommandRequestImpl::SendHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject* msg_params,
@@ -202,12 +256,6 @@ uint32_t CommandRequestImpl::SendHMIRequest(
const uint32_t hmi_correlation_id =
application_manager_.GetNextHMICorrelationID();
- if (use_events) {
- LOG4CXX_DEBUG(logger_,
- "subscribe_on_event " << function_id << " "
- << hmi_correlation_id);
- subscribe_on_event(function_id, hmi_correlation_id);
- }
smart_objects::SmartObject& request = *result;
request[strings::params][strings::message_type] = MessageType::kRequest;
@@ -222,9 +270,19 @@ uint32_t CommandRequestImpl::SendHMIRequest(
request[strings::msg_params] = *msg_params;
}
- if (!application_manager_.ManageHMICommand(result)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
- SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "subscribe_on_event " << function_id << " "
+ << hmi_correlation_id);
+ subscribe_on_event(function_id, hmi_correlation_id);
+ }
+ if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
+ if (!application_manager_.ManageHMICommand(result)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
+ SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_, "Interface is not available");
}
return hmi_correlation_id;
}
diff --git a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc
index e7fca943bc..681fbde7b3 100644
--- a/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_is_ready_response.cc
@@ -53,6 +53,12 @@ void UIIsReadyResponse::Run() {
HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_ui_cooperating(is_available);
+ const HmiInterfaces::InterfaceState interface_state =
+ is_available ? HmiInterfaces::STATE_AVAILABLE
+ : HmiInterfaces::STATE_NOT_AVAILABLE;
+ HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ hmi_interfaces.SetInterfaceState(HmiInterfaces::HMI_INTERFACE_UI,
+ inteface_state);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc
index 91dae226b6..1a7e70af70 100644
--- a/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vi_is_ready_response.cc
@@ -53,6 +53,13 @@ void VIIsReadyResponse::Run() {
HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_ivi_cooperating(is_available);
+ const HmiInterfaces::InterfaceState interface_state =
+ is_available ? HmiInterfaces::STATE_AVAILABLE
+ : HmiInterfaces::STATE_NOT_AVAILABLE;
+ HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ hmi_interfaces.SetInterfaceState(HmiInterfaces::HMI_INTERFACE_VehicleInfo,
+ inteface_state);
+
application_manager_.GetPolicyHandler().OnVIIsReady();
}
diff --git a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc
index 617742a28c..b316c06a54 100644
--- a/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_is_ready_response.cc
@@ -52,6 +52,13 @@ void VRIsReadyResponse::Run() {
HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities();
hmi_capabilities.set_is_vr_cooperating(is_available);
+
+ const HmiInterfaces::InterfaceState inteface_state =
+ is_available ? HmiInterfaces::STATE_AVAILABLE
+ : HmiInterfaces::STATE_NOT_AVAILABLE;
+ HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ hmi_interfaces.SetInterfaceState(HmiInterfaces::HMI_INTERFACE_VR,
+ inteface_state);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc
index 03bdfadd66..77a4fe5a76 100644
--- a/src/components/application_manager/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc
@@ -289,6 +289,7 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
return true;
}
+// TODO(AKUTSAN) APPLINK-26973: Refactor AddCommandRequest
void AddCommandRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace helpers;
@@ -318,17 +319,24 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS != ui_result_) {
(*message_)[strings::msg_params].erase(strings::menu_params);
}
+ if (message[strings::msg_params].keyExists(strings::info)) {
+ info_ += message[strings::msg_params][strings::info].asString();
+ }
break;
}
case hmi_apis::FunctionID::VR_AddCommand: {
LOG4CXX_INFO(logger_, "Received VR_AddCommand event");
is_vr_received_ = true;
+ MessageHelper::PrintSmartObject(message);
vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS != vr_result_) {
(*message_)[strings::msg_params].erase(strings::vr_commands);
}
+ if (message[strings::msg_params].keyExists(strings::info)) {
+ info_ += message[strings::msg_params][strings::info].asString();
+ }
break;
}
default: {
@@ -341,10 +349,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
return;
}
- if (hmi_apis::Common_Result::REJECTED == ui_result_) {
- RemoveCommand();
- }
-
smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
msg_params[strings::cmd_id] =
(*message_)[strings::msg_params][strings::cmd_id];
@@ -358,7 +362,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
hmi_apis::Common_Result::INVALID_ENUM,
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
- const bool is_ui_ivalid_unsupported =
+ const bool is_ui_invalid_unsupported =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
ui_result_,
hmi_apis::Common_Result::INVALID_ENUM,
@@ -367,28 +371,59 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
const bool is_no_ui_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
ui_result_,
hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS);
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
const bool is_no_vr_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
vr_result_,
hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS);
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
bool result = (is_no_ui_error && is_no_vr_error) ||
(is_no_ui_error && is_vr_invalid_unsupported) ||
- (is_no_vr_error && is_ui_ivalid_unsupported);
-
+ (is_no_vr_error && is_ui_invalid_unsupported);
+ LOG4CXX_DEBUG(logger_,
+ "calculated result " << ui_result_ << " " << is_no_ui_error
+ << " " << is_no_vr_error);
const bool is_vr_or_ui_warning =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_);
+ const bool is_vr_or_ui_unsupported =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ ui_result_,
+ vr_result_);
+
+ const bool is_vr_and_ui_unsupported =
+ Compare<hmi_apis::Common_Result::eType, EQ, ALL>(
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ ui_result_,
+ vr_result_);
+
if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) {
result_code = MessageHelper::HMIToMobileResult(ui_result_);
+ } else if (result && is_vr_or_ui_unsupported) {
+ result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
} else if (is_vr_or_ui_warning) {
result_code = mobile_apis::Result::WARNINGS;
} else {
result_code =
MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_));
+ if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_) {
+ result_code = MessageHelper::HMIToMobileResult(vr_result_);
+ }
+ if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == vr_result_) {
+ result_code = MessageHelper::HMIToMobileResult(ui_result_);
+ }
+ LOG4CXX_DEBUG(logger_, "HMIToMobileResult " << result_code);
}
if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) {
@@ -410,11 +445,13 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
application->RemoveCommand(
(*message_)[strings::msg_params][strings::cmd_id].asUInt());
result = false;
+ LOG4CXX_DEBUG(logger_, "Result " << result);
}
}
if (BothSend() && hmi_apis::Common_Result::SUCCESS == ui_result_ &&
- !is_no_vr_error) {
+ !is_no_vr_error &&
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != vr_result_) {
result_code = vr_result_ == hmi_apis::Common_Result::REJECTED
? mobile_apis::Result::REJECTED
: mobile_apis::Result::GENERIC_ERROR;
@@ -424,9 +461,27 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
application->RemoveCommand(
(*message_)[strings::msg_params][strings::cmd_id].asUInt());
result = false;
+ LOG4CXX_DEBUG(logger_, "Result " << result);
+ }
+
+ if (!BothSend() && is_vr_or_ui_unsupported) {
+ LOG4CXX_DEBUG(logger_, "!BothSend() && is_vr_or_ui_unsupported");
+ result = false;
+ }
+
+ if (is_vr_and_ui_unsupported) {
+ LOG4CXX_DEBUG(logger_, "UI and VR interface both unsupported");
+ result = false;
+ }
+
+ if (!result) {
+ RemoveCommand();
}
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ SendResponse(result,
+ result_code,
+ info_.empty() ? NULL : info_.c_str(),
+ &(message[strings::msg_params]));
if (result) {
application->UpdateHash();
diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
index b602601f26..01d223fd3a 100644
--- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -50,7 +50,8 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
: CommandRequestImpl(message, application_manager)
, expected_chs_count_(0)
, received_chs_count_(0)
- , error_from_hmi_(false) {}
+ , error_from_hmi_(false)
+ , vr_commands_lock_(true) {}
CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -287,6 +288,48 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_);
}
+void CreateInteractionChoiceSetRequest::ProcessHmiError(
+ const hmi_apis::Common_Result::eType vr_result) {
+ LOG4CXX_DEBUG(logger_,
+ "Hmi response is not Success: "
+ << vr_result << ". Stop sending VRAddCommand requests");
+ if (!error_from_hmi_) {
+ error_from_hmi_ = true;
+ std::string info =
+ vr_result == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE
+ ? "VR is not supported by system"
+ : "";
+ SendResponse(false, GetMobileResultCode(vr_result), info.c_str());
+ }
+}
+
+bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse(
+ const uint32_t corr_id) {
+ SentCommandsMap::iterator it = sent_commands_map_.find(corr_id);
+ if (sent_commands_map_.end() == it) {
+ LOG4CXX_WARN(logger_, "HMI response for unknown VR command received");
+ return false;
+ }
+ VRCommandInfo& vr_command = it->second;
+ vr_command.succesful_response_received_ = true;
+ return true;
+}
+
+void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() {
+ received_chs_count_++;
+ LOG4CXX_DEBUG(logger_,
+ "Got VR.AddCommand response, there are "
+ << expected_chs_count_ - received_chs_count_
+ << " more to wait.");
+ if (received_chs_count_ < expected_chs_count_) {
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
+ LOG4CXX_DEBUG(logger_, "Timeout for request was updated");
+ } else {
+ OnAllHMIResponsesReceived();
+ }
+}
+
void CreateInteractionChoiceSetRequest::on_event(
const event_engine::Event& event) {
using namespace hmi_apis;
@@ -294,50 +337,25 @@ void CreateInteractionChoiceSetRequest::on_event(
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
+ const Common_Result::eType result = static_cast<Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ const bool is_no_error = Compare<Common_Result::eType, EQ, ONE>(
+ result, Common_Result::SUCCESS, Common_Result::WARNINGS);
+ uint32_t corr_id = static_cast<uint32_t>(
+ message[strings::params][strings::correlation_id].asUInt());
if (event.id() == hmi_apis::FunctionID::VR_AddCommand) {
- received_chs_count_++;
- LOG4CXX_DEBUG(logger_,
- "Got VR.AddCommand response, there are "
- << expected_chs_count_ - received_chs_count_
- << " more to wait.");
-
- uint32_t corr_id = static_cast<uint32_t>(
- message[strings::params][strings::correlation_id].asUInt());
{
sync_primitives::AutoLock commands_lock(vr_commands_lock_);
- SentCommandsMap::iterator it = sent_commands_map_.find(corr_id);
- if (sent_commands_map_.end() == it) {
- LOG4CXX_WARN(logger_, "HMI response for unknown VR command received");
- return;
- }
-
- Common_Result::eType vr_result = static_cast<Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
- const bool is_vr_no_error = Compare<Common_Result::eType, EQ, ONE>(
- vr_result, Common_Result::SUCCESS, Common_Result::WARNINGS);
-
- if (is_vr_no_error) {
- VRCommandInfo& vr_command = it->second;
- vr_command.succesful_response_received_ = true;
- } else {
- LOG4CXX_DEBUG(logger_,
- "Hmi response is not Success: "
- << vr_result
- << ". Stop sending VRAddCommand requests");
- if (!error_from_hmi_) {
- error_from_hmi_ = true;
- SendResponse(false, GetMobileResultCode(vr_result));
+ if (is_no_error) {
+ if (!ProcessSuccesfulHMIResponse(corr_id)) {
+ return;
}
+ } else {
+ ProcessHmiError(result);
}
}
- if (received_chs_count_ < expected_chs_count_) {
- application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
- LOG4CXX_DEBUG(logger_, "Timeout for request was updated");
- return;
- }
- OnAllHMIResponsesReceived();
+
+ CountReceivedVRResponses();
}
}
@@ -379,7 +397,7 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param);
} else {
LOG4CXX_WARN(logger_,
- "Succesfull response has not been received for cmd_id = "
+ "succesful response has not been received for cmd_id = "
<< vr_command_info.cmd_id_);
}
}
diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc
index 9a7b92f7b8..7de1188c97 100644
--- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc
@@ -111,12 +111,93 @@ void DeleteCommandRequest::Run() {
}
}
+bool DeleteCommandRequest::CalculateResult() {
+ using namespace helpers;
+ // Invalid enum means that request didn't sent
+ const bool is_vr_success_invalid =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::INVALID_ENUM);
+
+ const bool is_ui_success_invalid =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::INVALID_ENUM);
+
+ const bool is_vr_ui_invalid =
+ Compare<hmi_apis::Common_Result::eType, EQ, ALL>(
+ hmi_apis::Common_Result::INVALID_ENUM, vr_result_, ui_result_);
+
+ const bool is_ui_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_, hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_vr_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_, hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_vr_unsupported =
+ vr_result_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
+ const bool is_ui_unsupported =
+ ui_result_ == hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
+
+ const bool is_ui_success_warnings =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
+
+ const bool is_vr_success_warnings =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
+
+ // At least one (VR or UI is success or didn't sent)
+ bool result =
+ (is_vr_success_invalid && is_ui_success_invalid && !is_vr_ui_invalid);
+
+ // VR is succeed on didn't send, but UI respond with WARNING
+ result = result || (is_vr_success_invalid && is_ui_warning);
+
+ // UI is succeed on didn't send, but VR respond with WARNINGS
+ result = result || (is_ui_success_invalid && is_vr_warning);
+
+ // If VR is unsupported UI should be SUCCESS or WARNINGS
+ result = result || (is_vr_unsupported && is_ui_success_warnings);
+
+ // If VR is unsupported UI should be SUCCESS or WARNINGS
+ result = result || (is_ui_unsupported && is_vr_success_warnings);
+
+ LOG4CXX_DEBUG(logger_, "Result is " << (result ? "true" : "false"));
+
+ return result;
+}
+
void DeleteCommandRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
-
+ if (message[strings::msg_params].keyExists(strings::info)) {
+ info_ += message[strings::msg_params][strings::info].asString();
+ }
switch (event.id()) {
case hmi_apis::FunctionID::UI_DeleteCommand: {
is_ui_received_ = true;
@@ -168,34 +249,16 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
return;
}
- const bool is_vr_success_invalid =
- Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- vr_result_,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::INVALID_ENUM);
-
- const bool is_ui_success_invalid =
- Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- ui_result_,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::INVALID_ENUM);
-
- const bool is_vr_ui_invalid =
- Compare<hmi_apis::Common_Result::eType, EQ, ALL>(
- hmi_apis::Common_Result::INVALID_ENUM, vr_result_, ui_result_);
+ bool result = CalculateResult();
const bool is_vr_or_ui_warning =
Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_);
-
- const bool result =
- // In case of UI/VR is SUCCESS and other is SUCCESS/INVALID_ENUM
- (is_vr_success_invalid && is_ui_success_invalid && !is_vr_ui_invalid) ||
- // or one of them is WARNINGS
- is_vr_or_ui_warning;
-
- LOG4CXX_DEBUG(logger_, "Result code is " << (result ? "true" : "false"));
-
+ const bool is_vr_or_ui_unsupported =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ ui_result_,
+ vr_result_);
if (result) {
application->RemoveCommand(msg_params[strings::cmd_id].asInt());
}
@@ -203,6 +266,9 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) {
result_code = MessageHelper::HMIToMobileResult(vr_result_);
+ } else if (result && is_vr_or_ui_unsupported) {
+ LOG4CXX_DEBUG(logger_, "VR or UI result is unsupported resource");
+ result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE;
} else if (is_vr_or_ui_warning) {
LOG4CXX_DEBUG(logger_, "VR or UI result is warning");
result_code = mobile_apis::Result::WARNINGS;
@@ -211,7 +277,8 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_));
}
- SendResponse(result, result_code, NULL, &msg_params);
+ SendResponse(
+ result, result_code, info_.empty() ? NULL : info_.c_str(), &msg_params);
if (result) {
application->UpdateHash();
}
diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc
index 69885f9d40..08ec8e179c 100644
--- a/src/components/application_manager/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc
@@ -102,13 +102,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
bool result = mobile_apis::Result::SUCCESS == result_code;
- const std::string return_info =
- message[strings::msg_params][hmi_response::message].asString();
-
- SendResponse(result,
- result_code,
- return_info.c_str(),
- &(message[strings::msg_params]));
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
break;
}
default: {
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 2c53fc0db2..284c3016f0 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
@@ -312,61 +312,27 @@ void RegisterAppInterfaceRequest::Run() {
SendRegisterAppInterfaceResponseToMobile();
}
-void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
- LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
-
- mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
-
- const HMICapabilities& hmi_capabilities =
- application_manager_.hmi_capabilities();
-
- const uint32_t key = connection_key();
- ApplicationSharedPtr application = application_manager_.application(key);
-
- resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
-
- if (!application) {
- LOG4CXX_ERROR(logger_,
- "There is no application for such connection key" << key);
- LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer");
- resumer.OnAppRegistrationEnd();
- return;
+void FillVRRelatedFields(smart_objects::SmartObject& response_params,
+ const HMICapabilities& hmi_capabilities) {
+ response_params[strings::language] = hmi_capabilities.active_vr_language();
+ if (hmi_capabilities.vr_capabilities()) {
+ response_params[strings::vr_capabilities] =
+ *hmi_capabilities.vr_capabilities();
}
+}
- response_params[strings::sync_msg_version][strings::major_version] =
- major_version; // From generated file interfaces/generated_msg_version.h
- response_params[strings::sync_msg_version][strings::minor_version] =
- minor_version; // From generated file interfaces/generated_msg_version.h
+void FillVIRelatedFields(smart_objects::SmartObject& response_params,
+ const HMICapabilities& hmi_capabilities) {
+ if (hmi_capabilities.vehicle_type()) {
+ response_params[hmi_response::vehicle_type] =
+ *hmi_capabilities.vehicle_type();
+ }
+}
- response_params[strings::language] = hmi_capabilities.active_vr_language();
+void FillUIRelatedFields(smart_objects::SmartObject& response_params,
+ const HMICapabilities& hmi_capabilities) {
response_params[strings::hmi_display_language] =
hmi_capabilities.active_ui_language();
-
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
-
- if (msg_params[strings::language_desired].asInt() !=
- hmi_capabilities.active_vr_language() ||
- msg_params[strings::hmi_display_language_desired].asInt() !=
- hmi_capabilities.active_ui_language()) {
- LOG4CXX_WARN(logger_,
- "Wrong language on registering application "
- << application->name().c_str());
-
- LOG4CXX_ERROR(
- logger_,
- "VR language desired code is "
- << msg_params[strings::language_desired].asInt()
- << " , active VR language code is "
- << hmi_capabilities.active_vr_language() << ", UI language code is "
- << msg_params[strings::hmi_display_language_desired].asInt()
- << " , active UI language code is "
- << hmi_capabilities.active_ui_language());
-
- result_code = mobile_apis::Result::WRONG_LANGUAGE;
- }
-
if (hmi_capabilities.display_capabilities()) {
response_params[hmi_response::display_capabilities] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -402,13 +368,10 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
hmi_capabilities.display_capabilities()->getElement(
hmi_response::num_custom_presets_available);
- if (hmi_capabilities.display_capabilities()
- ->getElement(hmi_response::image_capabilities)
- .length() > 0) {
- display_caps[hmi_response::graphic_supported] = true;
- } else {
- display_caps[hmi_response::graphic_supported] = false;
- }
+ display_caps[hmi_response::graphic_supported] =
+ (hmi_capabilities.display_capabilities()
+ ->getElement(hmi_response::image_capabilities)
+ .length() > 0);
display_caps[hmi_response::templates_available] =
hmi_capabilities.display_capabilities()->getElement(
@@ -423,6 +386,88 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
hmi_response::num_custom_presets_available);
}
+ if (hmi_capabilities.audio_pass_thru_capabilities()) {
+ if (smart_objects::SmartType_Array ==
+ hmi_capabilities.audio_pass_thru_capabilities()->getType()) {
+ // hmi_capabilities json contains array and HMI response object
+ response_params[strings::audio_pass_thru_capabilities] =
+ *hmi_capabilities.audio_pass_thru_capabilities();
+ } else {
+ response_params[strings::audio_pass_thru_capabilities][0] =
+ *hmi_capabilities.audio_pass_thru_capabilities();
+ }
+ }
+ response_params[strings::hmi_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ response_params[strings::hmi_capabilities][strings::navigation] =
+ hmi_capabilities.navigation_supported();
+ response_params[strings::hmi_capabilities][strings::phone_call] =
+ hmi_capabilities.phone_call_supported();
+}
+
+void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+
+ mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
+
+ const HMICapabilities& hmi_capabilities =
+ application_manager_.hmi_capabilities();
+
+ const uint32_t key = connection_key();
+ ApplicationSharedPtr application = application_manager_.application(key);
+
+ resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_,
+ "There is no application for such connection key" << key);
+ LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer");
+ resumer.OnAppRegistrationEnd();
+ return;
+ }
+
+ response_params[strings::sync_msg_version][strings::major_version] =
+ major_version; // From generated file interfaces/generated_msg_version.h
+ response_params[strings::sync_msg_version][strings::minor_version] =
+ minor_version; // From generated file interfaces/generated_msg_version.h
+
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+
+ if (msg_params[strings::language_desired].asInt() !=
+ hmi_capabilities.active_vr_language() ||
+ msg_params[strings::hmi_display_language_desired].asInt() !=
+ hmi_capabilities.active_ui_language()) {
+ LOG4CXX_WARN(logger_,
+ "Wrong language on registering application "
+ << application->name().c_str());
+
+ LOG4CXX_ERROR(
+ logger_,
+ "VR language desired code is "
+ << msg_params[strings::language_desired].asInt()
+ << " , active VR language code is "
+ << hmi_capabilities.active_vr_language() << ", UI language code is "
+ << msg_params[strings::hmi_display_language_desired].asInt()
+ << " , active UI language code is "
+ << hmi_capabilities.active_ui_language());
+
+ result_code = mobile_apis::Result::WRONG_LANGUAGE;
+ }
+
+ if (application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::HMI_INTERFACE_VR) !=
+ HmiInterfaces::STATE_NOT_AVAILABLE) {
+ FillVRRelatedFields(response_params, hmi_capabilities);
+ }
+
+ if (application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::HMI_INTERFACE_UI) !=
+ HmiInterfaces::STATE_NOT_AVAILABLE) {
+ FillUIRelatedFields(response_params, hmi_capabilities);
+ }
+
if (hmi_capabilities.button_capabilities()) {
response_params[hmi_response::button_capabilities] =
*hmi_capabilities.button_capabilities();
@@ -450,29 +495,18 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
response_params[strings::speech_capabilities] =
*hmi_capabilities.speech_capabilities();
}
- if (hmi_capabilities.vr_capabilities()) {
- response_params[strings::vr_capabilities] =
- *hmi_capabilities.vr_capabilities();
- }
- if (hmi_capabilities.audio_pass_thru_capabilities()) {
- if (smart_objects::SmartType_Array ==
- hmi_capabilities.audio_pass_thru_capabilities()->getType()) {
- // hmi_capabilities json contains array and HMI response object
- response_params[strings::audio_pass_thru_capabilities] =
- *hmi_capabilities.audio_pass_thru_capabilities();
- } else {
- response_params[strings::audio_pass_thru_capabilities][0] =
- *hmi_capabilities.audio_pass_thru_capabilities();
- }
- }
+
if (hmi_capabilities.pcm_stream_capabilities()) {
response_params[strings::pcm_stream_capabilities] =
*hmi_capabilities.pcm_stream_capabilities();
}
- if (hmi_capabilities.vehicle_type()) {
- response_params[hmi_response::vehicle_type] =
- *hmi_capabilities.vehicle_type();
+
+ if (HmiInterfaces::STATE_NOT_AVAILABLE !=
+ application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo)) {
+ FillVIRelatedFields(response_params, hmi_capabilities);
}
+
if (hmi_capabilities.prerecorded_speech()) {
response_params[strings::prerecorded_speech] =
*(hmi_capabilities.prerecorded_speech());
@@ -488,13 +522,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
++index;
}
}
-
- response_params[strings::hmi_capabilities] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- response_params[strings::hmi_capabilities][strings::navigation] =
- hmi_capabilities.navigation_supported();
- response_params[strings::hmi_capabilities][strings::phone_call] =
- hmi_capabilities.phone_call_supported();
response_params[strings::sdl_version] =
application_manager_.get_settings().sdl_version();
const std::string ccpu_version =
@@ -539,50 +566,53 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
application->mac_address());
}
- hmi_apis::Common_SpeechCapabilities::eType tts_name_type =
- hmi_apis::Common_SpeechCapabilities::INVALID_ENUM;
- if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) {
- tts_name_type = static_cast<hmi_apis::Common_SpeechCapabilities::eType>(
- (*message_)[strings::msg_params][strings::tts_name][0][strings::type]
- .asInt());
- }
-
- if (hmi_apis::Common_SpeechCapabilities::SAPI_PHONEMES == tts_name_type ||
- hmi_apis::Common_SpeechCapabilities::LHPLUS_PHONEMES == tts_name_type ||
- hmi_apis::Common_SpeechCapabilities::PRE_RECORDED == tts_name_type ||
- hmi_apis::Common_SpeechCapabilities::SILENCE == tts_name_type) {
- result_code = mobile_apis::Result::WARNINGS;
- add_info = "ttsChunks is sent but is not supported";
- }
-
- app_launch::AppLaunchCtrl& app_launch_ctrl =
- application_manager_.app_launch_ctrl();
- app_launch_ctrl.OnAppRegistered(*application);
SendOnAppRegisteredNotificationToHMI(
*(application.get()), resumption, need_restore_vr);
SendResponse(true, result_code, add_info.c_str(), &response_params);
- // Check if application exists, because application might be unregestered
- // during sending reponse to mobile.
- application = application_manager_.application(key);
- if (application) {
- LOG4CXX_DEBUG(logger_, "Application with app_id = " << key << " exists.");
- if (result_code != mobile_apis::Result::RESUME_FAILED) {
- resumer.StartResumption(application, hash_id);
- } else {
- resumer.StartResumptionOnlyHMILevel(application);
- }
+ if (result_code != mobile_apis::Result::RESUME_FAILED) {
+ resumer.StartResumption(application, hash_id);
+ } else {
+ resumer.StartResumptionOnlyHMILevel(application);
+ }
- // By default app subscribed to CUSTOM_BUTTON
- SendSubscribeCustomButtonNotification();
- MessageHelper::SendChangeRegistrationRequestToHMI(application,
- application_manager_);
+ // By default app subscribed to CUSTOM_BUTTON
+ SendSubscribeCustomButtonNotification();
+ SendChangeRagistrationOnHMI(application);
+}
+
+void RegisterAppInterfaceRequest::SendChangeRegistration(
+ const hmi_apis::FunctionID::eType function_id,
+ const int32_t language,
+ const uint32_t app_id) {
+ using helpers::Compare;
+ using helpers::EQ;
+ using helpers::ONE;
+ const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ const HmiInterfaces::InterfaceID interface =
+ hmi_interfaces.GetInterfaceFromFunction(function_id);
+ if (hmi_interfaces.GetInterfaceState(interface) !=
+ HmiInterfaces::STATE_NOT_AVAILABLE) {
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ msg_params[strings::language] = language;
+ msg_params[strings::app_id] = app_id;
+ SendHMIRequest(function_id, &msg_params);
} else {
- LOG4CXX_DEBUG(logger_,
- "Application with app_id = " << key << " doesn't exist.");
+ LOG4CXX_DEBUG(logger_, "Interface " << interface << "is not avaliable");
}
}
+void RegisterAppInterfaceRequest::SendChangeRagistrationOnHMI(
+ ApplicationConstSharedPtr app) {
+ using namespace hmi_apis::FunctionID;
+ DCHECK_OR_RETURN_VOID(app);
+ DCHECK_OR_RETURN_VOID(mobile_apis::Language::INVALID_ENUM != app->language());
+ SendChangeRegistration(VR_ChangeRegistration, app->language(), app->app_id());
+ SendChangeRegistration(
+ TTS_ChangeRegistration, app->language(), app->app_id());
+ SendChangeRegistration(UI_ChangeRegistration, app->language(), app->app_id());
+}
+
void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
const Application& application_impl,
bool resumption,
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
new file mode 100644
index 0000000000..08f5d3cc93
--- /dev/null
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/hmi_interfaces_impl.h"
+namespace application_manager {
+
+std::map<hmi_apis::FunctionID::eType, HmiInterfaces::InterfaceID>
+generate_function_to_interface_convert_map() {
+ using namespace hmi_apis::FunctionID;
+ std::map<hmi_apis::FunctionID::eType, HmiInterfaces::InterfaceID> convert_map;
+ convert_map[Buttons_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_Buttons;
+ convert_map[Buttons_OnButtonEvent] = HmiInterfaces::HMI_INTERFACE_Buttons;
+ convert_map[Buttons_OnButtonPress] = HmiInterfaces::HMI_INTERFACE_Buttons;
+ convert_map[Buttons_OnButtonSubscription] =
+ HmiInterfaces::HMI_INTERFACE_Buttons;
+ convert_map[BasicCommunication_OnReady] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnStartDeviceDiscovery] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnUpdateDeviceList] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnPhoneCall] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnEmergencyEvent] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnResumeAudioSource] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnSDLPersistenceComplete] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_UpdateAppList] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_UpdateDeviceList] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnFileRemoved] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_AllowDeviceToConnect] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnDeviceChosen] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnFindApplications] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_ActivateApp] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnAppActivated] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnAppDeactivated] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnAppRegistered] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnAppUnregistered] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnExitApplication] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnExitAllApplications] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnAwakeSDL] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_MixingAudioSupported] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_DialNumber] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnSystemRequest] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_SystemRequest] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_PolicyUpdate] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnSDLClose] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnPutFile] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_GetSystemInfo] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnSystemInfoChanged] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnIgnitionCycleOver] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnDeactivateHMI] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnEventChanged] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_AddCommand] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_DeleteCommand] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_PerformInteraction] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_OnCommand] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_ChangeRegistration] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_OnLanguageChange] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_GetLanguage] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[VR_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[TTS_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_VR;
+ convert_map[TTS_Started] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_Stopped] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_IsReady] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_Speak] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_StopSpeaking] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_ChangeRegistration] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_OnLanguageChange] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_GetLanguage] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[TTS_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_TTS;
+ convert_map[UI_Alert] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_Show] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_AddCommand] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_DeleteCommand] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_AddSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_DeleteSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_PerformInteraction] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_SetMediaClockTimer] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnCommand] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnSystemContext] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_ChangeRegistration] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnLanguageChange] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_GetLanguage] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnDriverDistraction] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_SetAppIcon] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_SetDisplayLayout] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_ShowCustomForm] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnKeyboardInput] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnTouchEvent] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_Slider] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_ScrollableMessage] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_PerformAudioPassThru] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_EndAudioPassThru] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_IsReady] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_ClosePopUp] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[Navigation_IsReady] = HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_SendLocation] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_ShowConstantTBT] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_AlertManeuver] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_UpdateTurnList] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_OnTBTClientState] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_StartStream] = HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_StopStream] = HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_StartAudioStream] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_StopAudioStream] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_OnAudioDataStreaming] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_OnVideoDataStreaming] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_GetWayPoints] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_OnWayPointChange] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_SubscribeWayPoints] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[Navigation_UnsubscribeWayPoints] =
+ HmiInterfaces::HMI_INTERFACE_Navigation;
+ convert_map[VehicleInfo_IsReady] = HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_GetVehicleType] =
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_ReadDID] = HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_GetDTCs] = HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_DiagnosticMessage] =
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_SubscribeVehicleData] =
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_UnsubscribeVehicleData] =
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_GetVehicleData] =
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[VehicleInfo_OnVehicleData] =
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo;
+ convert_map[SDL_ActivateApp] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_GetUserFriendlyMessage] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnAllowSDLFunctionality] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnReceivedPolicyUpdate] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnPolicyUpdate] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_GetListOfPermissions] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnAppPermissionConsent] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnAppPermissionChanged] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnSDLConsentNeeded] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_UpdateSDL] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_GetStatusUpdate] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnStatusUpdate] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_OnSystemError] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_AddStatisticsInfo] = HmiInterfaces::HMI_INTERFACE_SDL;
+ convert_map[SDL_GetURLS] = HmiInterfaces::HMI_INTERFACE_SDL;
+ return convert_map;
+}
+
+HmiInterfacesImpl::HmiInterfacesImpl() {
+ sync_primitives::AutoLock autolock(interfaces_states_lock_);
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_BasicCommunication] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_Buttons] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_Navigation] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_SDL] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_TTS] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_UI] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_VehicleInfo] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_VR] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
+}
+
+HmiInterfaces::InterfaceState HmiInterfacesImpl::GetInterfaceState(
+ HmiInterfaces::InterfaceID interface) const {
+ sync_primitives::AutoLock autolock(interfaces_states_lock_);
+ const InterfaceStatesMap::const_iterator it =
+ interfaces_states_.find(interface);
+ // all interfaces should be presented in interfaces_states_ map.
+ DCHECK_OR_RETURN(it != interfaces_states_.end(), STATE_NOT_RESPONSE);
+ return it->second;
+}
+
+void HmiInterfacesImpl::SetInterfaceState(HmiInterfaces::InterfaceID interface,
+ HmiInterfaces::InterfaceState state) {
+ sync_primitives::AutoLock autolock(interfaces_states_lock_);
+ DCHECK(interfaces_states_.find(interface) != interfaces_states_.end());
+ interfaces_states_[interface] = state;
+}
+
+HmiInterfaces::InterfaceID HmiInterfacesImpl::GetInterfaceFromFunction(
+ hmi_apis::FunctionID::eType function) const {
+ // TODO(AKutsan): APPLINK-26874: Generate map of functionid to inteface
+ // automaticaly from
+ // HMI_API.xml
+ static const std::map<hmi_apis::FunctionID::eType, InterfaceID> convert_map =
+ generate_function_to_interface_convert_map();
+ const std::map<hmi_apis::FunctionID::eType, InterfaceID>::const_iterator it =
+ convert_map.find(function);
+ return it != convert_map.end() ? it->second : HMI_INTERFACE_INVALID_ENUM;
+}
+} // namespace application_manager
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 08efba3d70..a764c574d0 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -1156,51 +1156,6 @@ void MessageHelper::SendUIChangeRegistrationRequestToHMI(
}
}
-void MessageHelper::SendChangeRegistrationRequestToHMI(
- ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
- if (!app.valid()) {
- return;
- }
- if (mobile_apis::Language::INVALID_ENUM != app->language()) {
- smart_objects::SmartObjectSPtr vr_command =
- CreateChangeRegistration(hmi_apis::FunctionID::VR_ChangeRegistration,
- app->language(),
- app->app_id(),
- NULL,
- app_mngr);
-
- if (vr_command) {
- app_mngr.ManageHMICommand(vr_command);
- }
- }
-
- if (mobile_apis::Language::INVALID_ENUM != app->language()) {
- smart_objects::SmartObjectSPtr tts_command =
- CreateChangeRegistration(hmi_apis::FunctionID::TTS_ChangeRegistration,
- app->language(),
- app->app_id(),
- NULL,
- app_mngr);
-
- if (tts_command) {
- app_mngr.ManageHMICommand(tts_command);
- }
- }
-
- if (mobile_apis::Language::INVALID_ENUM != app->ui_language()) {
- smart_objects::SmartObjectSPtr ui_command =
- CreateChangeRegistration(hmi_apis::FunctionID::UI_ChangeRegistration,
- app->ui_language(),
- app->app_id(),
- NULL,
- app_mngr);
-
- if (ui_command) {
- app_mngr.ManageHMICommand(ui_command);
- }
- }
-}
-
void MessageHelper::SendAddVRCommandToHMI(
const uint32_t cmd_id,
const smart_objects::SmartObject& vr_commands,
diff --git a/src/components/application_manager/test/include/application_manager/mock_application_manager.h b/src/components/application_manager/test/include/application_manager/mock_application_manager.h
index f334093b5e..683da7c6d6 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application_manager.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application_manager.h
@@ -200,6 +200,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
bool(uint32_t connection_key,
const std::string& policy_app_id));
MOCK_METHOD0(resume_controller, resumption::ResumeCtrl&());
+ MOCK_METHOD0(hmi_interfaces, application_manager::HmiInterfaces&());
MOCK_METHOD0(app_launch_ctrl, app_launch::AppLaunchCtrl&());
MOCK_METHOD1(
GetDeviceTransportType,
diff --git a/src/components/include/security_manager/crypto_manager.h b/src/components/include/security_manager/crypto_manager.h
index 9b11a8e4ae..18c06ffe06 100644
--- a/src/components/include/security_manager/crypto_manager.h
+++ b/src/components/include/security_manager/crypto_manager.h
@@ -58,7 +58,7 @@ class CryptoManager : public policy::PolicyHandlerObserver {
/**
* @brief Init allows to initialize cryptomanager with certain values.
*
- * @return true in case initialization was succesfull, false otherwise.
+ * @return true in case initialization was succesful, false otherwise.
*/
virtual bool Init() = 0;
virtual SSLContext* CreateSSLContext() = 0;
diff --git a/src/components/utils/include/utils/helpers.h b/src/components/utils/include/utils/helpers.h
index 17d4af27a1..f44bdfea9b 100644
--- a/src/components/utils/include/utils/helpers.h
+++ b/src/components/utils/include/utils/helpers.h
@@ -117,6 +117,15 @@ bool Compare(T what, T to, T to1, T to2, T to3, T to4) {
Compare<T, CompareType, CmpStrategy>(what, to4));
}
+template <typename T,
+ bool (*CompareType)(T, T),
+ bool (*CmpStrategy)(bool, bool)>
+bool Compare(T what, T to, T to1, T to2, T to3, T to4, T to5) {
+ return CmpStrategy(
+ Compare<T, CompareType, CmpStrategy>(what, to, to1, to2, to3),
+ Compare<T, CompareType, CmpStrategy>(what, to4, to5));
+}
+
template <typename Container>
bool in_range(const Container& container,
const typename Container::value_type& value) {