summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h26
-rw-r--r--src/components/application_manager/src/commands/hmi/request_from_hmi.cc53
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc19
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc6
-rw-r--r--src/components/hmi_message_handler/src/dbus_message_adapter.cc2
-rw-r--r--src/components/interfaces/HMI_API.xml31
6 files changed, 70 insertions, 67 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h
index 0f3b8bf1e4..628d3257d9 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/request_from_hmi.h
@@ -63,9 +63,29 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
const hmi_apis::FunctionID::eType function_id,
const hmi_apis::Common_Result::eType result_code);
- void FillCommonParametersOfSO(smart_objects::SmartObject* message,
- uint32_t correlation_id,
- hmi_apis::FunctionID::eType function_id);
+ /**
+ * @brief SendResponse allows to send error response to hmi
+ * @param correlation_id the correlation id for the response.
+ * @param function_id the function id for which response will be sent
+ * @param result_code the result code.
+ * @param error_message info message for error.
+ */
+ void SendErrorResponse(const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code,
+ const std::string error_message);
+
+ private:
+ /**
+ * @brief Fills common parameters for SO
+ * @param message Contains SO for filling
+ * @param correlation_id the correlation id for the response.
+ * @param function_id the function id for which response will be sent
+ */
+ void FillCommonParametersOfSO(
+ NsSmartDeviceLink::NsSmartObjects::SmartObject& message,
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id);
private:
DISALLOW_COPY_AND_ASSIGN(RequestFromHMI);
diff --git a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
index be3cd6314c..3734f73e0d 100644
--- a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc
@@ -65,9 +65,10 @@ void RequestFromHMI::SendResponse(
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id,
const hmi_apis::Common_Result::eType result_code) {
- smart_objects::SmartObject* message =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
- FillCommonParametersOfSO(message, correlation_id, function_id);
+ smart_objects::SmartObjectSPtr message =
+ ::utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ FillCommonParametersOfSO(*message, correlation_id, function_id);
(*message)[strings::params][strings::message_type] = MessageType::kResponse;
(*message)[strings::params][hmi_response::code] = 0;
(*message)[strings::msg_params][strings::success] = success;
@@ -76,30 +77,32 @@ void RequestFromHMI::SendResponse(
application_manager_.ManageHMICommand(message);
}
-// void RequestFromHMI::SendErrorResponse(uint32_t correlation_id,
-// hmi_apis::FunctionID::eType
-// function_id,
-// hmi_apis::Common_Result::eType
-// result_code) {
-// smart_objects::SmartObject* message = new smart_objects::SmartObject(
-// smart_objects::SmartType_Map);
-// FillCommonParametersOfSO(message, correlation_id, function_id);
-// (*message)[strings::params][strings::message_type] =
-// MessageType::kErrorResponse;
-// (*message)[strings::params][hmi_response::code] = result_code;
-// (*message)[strings::params][strings::error_msg] = "HMIDeactivate is active";
-
-// application_manager_.ManageHMICommand(message);
-//}
+void RequestFromHMI::SendErrorResponse(
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code,
+ const std::string error_message) {
+ smart_objects::SmartObjectSPtr message =
+ ::utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ FillCommonParametersOfSO(*message, correlation_id, function_id);
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kErrorResponse;
+ (*message)[strings::params][hmi_response::code] = result_code;
+
+ (*message)[strings::params][strings::error_msg] = error_message;
+
+ application_manager_.ManageHMICommand(message);
+}
void RequestFromHMI::FillCommonParametersOfSO(
- smart_objects::SmartObject* message,
- uint32_t correlation_id,
- hmi_apis::FunctionID::eType function_id) {
- (*message)[strings::params][strings::function_id] = function_id;
- (*message)[strings::params][strings::protocol_type] = hmi_protocol_type_;
- (*message)[strings::params][strings::protocol_version] = protocol_version_;
- (*message)[strings::params][strings::correlation_id] = correlation_id;
+ smart_objects::SmartObject& message,
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id) {
+ (message)[strings::params][strings::function_id] = function_id;
+ (message)[strings::params][strings::protocol_type] = hmi_protocol_type_;
+ (message)[strings::params][strings::protocol_version] = protocol_version_;
+ (message)[strings::params][strings::correlation_id] = correlation_id;
}
} // namespace commands
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..4a501b5449 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
@@ -118,6 +118,18 @@ void SDLActivateAppRequest::Run() {
"Found application to activate. Application id is "
<< app_to_activate->app_id());
+ if (application_manager_.state_controller().IsStateActive(
+ HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) {
+ LOG4CXX_WARN(logger_,
+ "DeactivateHmi state is active. "
+ "Sends response with result code REJECTED");
+ SendErrorResponse(correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()),
+ hmi_apis::Common_Result::REJECTED,
+ "HMIDeactivate is active");
+ return;
+ }
+
if (app_to_activate->IsRegistered()) {
LOG4CXX_DEBUG(logger_, "Application is registered. Activating.");
application_manager_.GetPolicyHandler().OnActivateApp(application_id,
@@ -134,7 +146,8 @@ void SDLActivateAppRequest::Run() {
"Can't find regular foreground app with the same "
"connection id:"
<< device_handle);
- SendResponse(false, correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED);
+ SendErrorResponse(
+ correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED, "");
return;
}
@@ -165,8 +178,8 @@ void SDLActivateAppRequest::onTimeOut() {
using namespace hmi_apis::Common_Result;
using namespace application_manager;
unsubscribe_from_event(BasicCommunication_OnAppRegistered);
- SendResponse(
- false, correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED);
+ SendErrorResponse(
+ correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED, "");
}
void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index 5665d0654a..8a9944bec4 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -48,10 +48,6 @@ generate_function_to_interface_convert_map() {
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] =
@@ -104,8 +100,6 @@ generate_function_to_interface_convert_map() {
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;
diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
index daefd32de9..00f5ad6be8 100644
--- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc
+++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
@@ -126,8 +126,6 @@ void DBusMessageAdapter::SubscribeTo() {
DBusMessageController::SubscribeTo("BasicCommunication", "OnSystemRequest");
DBusMessageController::SubscribeTo("BasicCommunication",
"OnSystemInfoChanged");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnPhoneCall");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnEmergencyEvent");
DBusMessageController::SubscribeTo("TTS", "Started");
DBusMessageController::SubscribeTo("TTS", "Stopped");
DBusMessageController::SubscribeTo("TTS", "OnLanguageChange");
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 022053f96a..1398941eff 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -2140,21 +2140,6 @@
<function name="OnUpdateDeviceList" messagetype="notification">
<description>Notification from HMI to SDL sent when HMI requires update of device list (i.e. when user clicks 'Change Device' button)</description>
</function>
- <function name="OnPhoneCall" messagetype="notification">
- <description>Sender: HMI->SDL. When: upon phone-call event started or ended</description>
- <param name="isActive" type="Boolean" mandatory="true">
- <description>Must be 'true' - when the phone call is started on HMI. Must be 'false' when the phone call is ended on HMI</description>
- </param>
- </function>
- <function name="OnEmergencyEvent" messagetype="notification">
- <description>
- "Sender: HMI->SDL. Conditions: when HMI enters the mode of "911 Assist", or other rear view camera,
- or something else in the future. Purpose: for SDL to change the audioStreamingState of the related apps to
- NOT_AUDIBLE when "enabled:true" and back to AUDIBLE when "enabled:false""
- </description>
- <param name="enabled" type="Boolean" mandatory="true">
- </param>
- </function>
<function name="OnResumeAudioSource" messagetype="notification">
<description>This method must be invoked by SDL to update audio state.</description>
<param name="appID" type="Integer" mandatory="true">
@@ -2456,16 +2441,6 @@
<description>Notification from system to SDL to let it know that ignition cycle is over.</description>
</function>
<!-- End of Policies -->
- <function name="OnDeactivateHMI" messagetype="notification">
- <description>
- Sender: HMI->SDL. When: in case GAL/DIO is active or disabling
- </description>
- <param name="isDeactivated" type="Boolean" mandatory="true">
- <description>
- Must be 'true' - GAL/DIO is active. Must be 'false' when GAL/DIO is disabling
- </description>
- </param>
- </function>
<function name="OnEventChanged" messagetype="notification">
<description>Sender: HMI->SDL. When event is become active</description>
<param name="eventName" type="Common.EventTypes" mandatory="true">
@@ -3415,9 +3390,9 @@
<param name="wayPointType" type="Common.WayPointType" defvalue="ALL" mandatory="false">
<description>To request for either the destination only or for all waypoints including destination</description>
</param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application.</description>
- </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of the application.</description>
+ </param>
</function>
<function name="GetWayPoints" functionID="GetWayPointsID" messagetype="response">
<param name="appID" type="Integer" mandatory="true">