summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-08-08 11:29:43 -0400
committerJackLivio <jack@livio.io>2018-08-08 11:29:43 -0400
commita93b4d8ebfa0e5ca3b5a0ec864827ff5f489d927 (patch)
tree34c3d3183cfad7d77fcd9c9a1c5afaf77fe25f29 /src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src
parent4a62af6362d071bb962ab94c7d3829318f251f96 (diff)
parent5f651c9e75441633c4e489d81b09900d1457bfb1 (diff)
downloadsdl_core-a93b4d8ebfa0e5ca3b5a0ec864827ff5f489d927.tar.gz
Merge branch 'feature/mobile_versioning' into feature/full_app_id
# Conflicts: # src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc50
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc6
11 files changed, 64 insertions, 51 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index fc836aae5f..155f819761 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -96,7 +96,7 @@ void AddCommandRequest::Run() {
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
index 3dcc414f9e..183b445326 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
@@ -76,7 +76,7 @@ void AddSubMenuRequest::Run() {
verification_result = MessageHelper::VerifyImage(
received_msg_params[strings::menu_icon], app, application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
@@ -117,10 +117,7 @@ void AddSubMenuRequest::Run() {
msg_params[strings::menu_params][strings::menu_name] =
received_msg_params[strings::menu_name];
msg_params[strings::app_id] = app->app_id();
-
- if (mobile_apis::Result::SUCCESS == verification_result) {
- msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon];
- }
+ msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon];
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
index d2d39dcd77..9b7653ac52 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -42,11 +42,13 @@
#include "utils/gen_hash.h"
#include "utils/helpers.h"
-namespace sdl_rpc_plugin {
-using namespace application_manager;
+const char* kInvalidImageWarningInfo = "Requested image(s) not found.";
+namespace sdl_rpc_plugin {
namespace commands {
+using namespace application_manager;
+
CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -78,6 +80,7 @@ void CreateInteractionChoiceSetRequest::Run() {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
+ should_send_warnings = false;
for (uint32_t i = 0;
i < (*message_)[strings::msg_params][strings::choice_set].length();
++i) {
@@ -104,6 +107,10 @@ void CreateInteractionChoiceSetRequest::Run() {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, Result::INVALID_DATA);
return;
+ } else if (verification_result_image == Result::WARNINGS ||
+ verification_result_secondary_image == Result::WARNINGS) {
+ should_send_warnings = true;
+ break;
}
}
@@ -435,7 +442,9 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
LOG4CXX_AUTO_TRACE(logger_);
- if (!error_from_hmi_) {
+ if (!error_from_hmi_ && should_send_warnings) {
+ SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo);
+ } else if (!error_from_hmi_) {
SendResponse(true, mobile_apis::Result::SUCCESS);
} else {
DeleteChoices();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index 8710f3c3d6..ec06f0bb31 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -165,7 +165,7 @@ void PerformInteractionRequest::Run() {
}
if (msg_params.keyExists(strings::vr_help)) {
- if (mobile_apis::Result::SUCCESS !=
+ if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
msg_params[strings::vr_help], app, application_manager_)) {
LOG4CXX_ERROR(logger_,
@@ -343,27 +343,31 @@ bool PerformInteractionRequest::ProcessVRResponse(
return false;
}
- if (Common_Result::SUCCESS == vr_result_code_ &&
- InteractionMode::MANUAL_ONLY == interaction_mode_) {
- LOG4CXX_DEBUG(logger_,
- "VR response SUCCESS in MANUAL_ONLY mode "
- << "Wait for UI response");
- // in case MANUAL_ONLY mode VR.PI SUCCESS just return
- return false;
- }
-
const SmartObject& hmi_msg_params = message[strings::msg_params];
if (hmi_msg_params.keyExists(strings::choice_id)) {
- const int choise_id = hmi_msg_params[strings::choice_id].asInt();
- if (!CheckChoiceIDFromResponse(app, choise_id)) {
+ const int choice_id = hmi_msg_params[strings::choice_id].asInt();
+ if (!CheckChoiceIDFromResponse(app, choice_id)) {
LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI");
TerminatePerformInteraction();
SendResponse(
false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI");
return true;
}
- msg_params[strings::choice_id] = choise_id;
+ msg_params[strings::choice_id] = choice_id;
+ }
+
+ const bool is_vr_result_success = Compare<Common_Result::eType, EQ, ONE>(
+ vr_result_code_, Common_Result::SUCCESS, Common_Result::WARNINGS);
+
+ if (is_vr_result_success &&
+ InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ LOG4CXX_DEBUG(logger_,
+ "VR response is successfull in MANUAL_ONLY mode "
+ << "Wait for UI response");
+ // in case MANUAL_ONLY mode VR.PI SUCCESS just return
+ return false;
}
+
return false;
}
@@ -401,19 +405,19 @@ void PerformInteractionRequest::ProcessUIResponse(
ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
if (result) {
- if (is_pi_warning) {
- ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
- ui_info_ = message[strings::msg_params][strings::info].asString();
- if (message.keyExists(strings::params) &&
- message[strings::params].keyExists(strings::data)) {
- msg_params = message[strings::params][strings::data];
- }
- } else if (is_pi_unsupported) {
+ if (is_pi_unsupported) {
ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
ui_info_ = message[strings::msg_params][strings::info].asString();
- } else if (message.keyExists(strings::msg_params)) {
- msg_params = message[strings::msg_params];
+ } else {
+ if (message.keyExists(strings::msg_params)) {
+ msg_params = message[strings::msg_params];
+ }
+ if (is_pi_warning) {
+ ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
+ ui_info_ = message[strings::msg_params][strings::info].asString();
+ }
}
+
// result code must be GENERIC_ERROR in case wrong choice_id
if (msg_params.keyExists(strings::choice_id)) {
if (!CheckChoiceIDFromResponse(app,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 9545abfe26..2b80c5efb9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -308,15 +308,19 @@ void RegisterAppInterfaceRequest::Run() {
uint16_t minor =
msg_params[strings::sync_msg_version][strings::minor_version].asUInt();
uint16_t patch = 0;
+ // Check if patch exists since it is not mandatory.
if (msg_params[strings::sync_msg_version].keyExists(strings::patch_version)) {
patch =
msg_params[strings::sync_msg_version][strings::patch_version].asUInt();
}
- if (major < minimum_major_version ||
- (major == minimum_major_version && minor < minimum_minor_version) ||
- (major == minimum_major_version && minor == minimum_minor_version &&
- patch < minimum_patch_version)) {
- LOG4CXX_ERROR(logger_, "Version Negotiation failed, mobile version is too low");
+
+ utils::SemanticVersion mobile_version(major, minor, patch);
+ utils::SemanticVersion min_module_version(
+ minimum_major_version, minimum_minor_version, minimum_patch_version);
+
+ if (mobile_version < min_module_version) {
+ LOG4CXX_WARN(logger_,
+ "Application RPC Version does not meet minimum requirement");
SendResponse(false, mobile_apis::Result::REJECTED);
}
@@ -328,15 +332,14 @@ void RegisterAppInterfaceRequest::Run() {
}
// Version negotiation
- utils::SemanticVersion mobile_version(major, minor, patch);
utils::SemanticVersion module_version(
major_version, minor_version, patch_version);
if (mobile_version < module_version) {
// Use mobile RPC version as negotiated version
- application->set_msg_version(major, minor, patch);
+ application->set_msg_version(mobile_version);
} else {
// Use module version as negotiated version
- application->set_msg_version(major_version, minor_version, patch_version);
+ application->set_msg_version(module_version);
}
// For resuming application need to restore hmi_app_id from resumeCtrl
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
index ab8de5923a..2719d0674d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
@@ -124,7 +124,7 @@ void SendLocationRequest::Run() {
(*message_)[strings::msg_params][strings::location_image],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
index b4b4e84f49..0c217b6b4f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
@@ -95,7 +95,7 @@ void SetGlobalPropertiesRequest::Run() {
(*message_)[strings::msg_params][strings::menu_icon],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
@@ -104,7 +104,7 @@ void SetGlobalPropertiesRequest::Run() {
}
// Check for image file(s) in vrHelpItem
if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) {
- if (mobile_apis::Result::SUCCESS !=
+ if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
(*message_)[strings::msg_params][strings::vr_help],
app,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
index c2eb067e18..3b2936e6cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
@@ -105,7 +105,7 @@ void ShowConstantTBTRequest::Run() {
if (msg_params.keyExists(strings::turn_icon)) {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::turn_icon], app, application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
@@ -115,7 +115,7 @@ void ShowConstantTBTRequest::Run() {
if (msg_params.keyExists(strings::next_turn_icon)) {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::next_turn_icon], app, application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
index 0fdf6d83cf..e0c3e1da9a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
@@ -143,7 +143,7 @@ void ShowRequest::Run() {
(*message_)[strings::msg_params][strings::graphic],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
@@ -155,7 +155,7 @@ void ShowRequest::Run() {
(*message_)[strings::msg_params][strings::secondary_graphic],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
index 69379135b5..c04ad34f5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
@@ -100,7 +100,7 @@ void UpdateTurnListRequest::Run() {
((*message_)[strings::msg_params][strings::turn_list]);
for (uint32_t i = 0; i < turn_list_array.length(); ++i) {
if ((turn_list_array[i].keyExists(strings::turn_icon)) &&
- (mobile_apis::Result::SUCCESS !=
+ (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon],
app,
application_manager_))) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 3d7e2f6437..4251eeadc9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -263,7 +263,7 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
}
case mobile_apis::FunctionID::GetWayPointsID: {
return mobile_api::messageType::request == message_type
- ? factory.GetCreator<commands::ShowConstantTBTRequest>()
+ ? factory.GetCreator<commands::GetWayPointsRequest>()
: factory.GetCreator<commands::GetWayPointsResponse>();
}
case mobile_apis::FunctionID::SubscribeWayPointsID: {
@@ -273,8 +273,8 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
}
case mobile_apis::FunctionID::UnsubscribeWayPointsID: {
return mobile_api::messageType::request == message_type
- ? factory.GetCreator<commands::ShowConstantTBTRequest>()
- : factory.GetCreator<commands::ShowConstantTBTResponse>();
+ ? factory.GetCreator<commands::UnSubscribeWayPointsRequest>()
+ : factory.GetCreator<commands::UnsubscribeWayPointsResponse>();
}
case mobile_apis::FunctionID::GetSystemCapabilityID: {
return mobile_api::messageType::request == message_type