summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConlain Kelly <conlain.k@gmail.com>2018-07-24 17:19:08 -0400
committerConlain Kelly <conlain.k@gmail.com>2018-07-24 17:19:08 -0400
commit1dc7bf3e56f927915c440ced3d102a2a53fb22db (patch)
tree07f2ad1e59ac20bec47a21658da2c09194c22e85
parent8ff26a734267451030ee8ee62b5f672324a755c9 (diff)
downloadsdl_core-1dc7bf3e56f927915c440ced3d102a2a53fb22db.tar.gz
style fix
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc8
5 files changed, 45 insertions, 42 deletions
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 3c90928d8a..b15cf0c615 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -855,23 +855,25 @@ class MessageHelper {
*/
static smart_objects::SmartObjectSPtr CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id);
-
-
+
// Check whether each choice has the vrCommands field
- // returns -1 for failure, 0 if all choice include vrCommands, and 1 if none do
+ // returns -1 for failure, 0 if all choice include vrCommands, and 1 if none
+ // do
// vrCommands is an all-or-none deal
static int CheckChoiceSet_VRCommands(
const smart_objects::SmartObject& choice_set) {
-
// if this becomes true, someone doesn't have vrCommands
bool all_have = true;
// if this is true, no one has vrCommands
bool none_have = true;
- smart_objects::SmartArray::const_iterator current_choice_set_it = choice_set.asArray()->begin();
+ smart_objects::SmartArray::const_iterator current_choice_set_it =
+ choice_set.asArray()->begin();
// Iterate through choices
- for (; choice_set.asArray()->end() != current_choice_set_it; ++current_choice_set_it) {
+ for (; choice_set.asArray()->end() != current_choice_set_it;
+ ++current_choice_set_it) {
// if the vrCommands is present
- if (current_choice_set_it->keyExists(application_manager::strings::vr_commands)) {
+ if (current_choice_set_it->keyExists(
+ application_manager::strings::vr_commands)) {
// this one has the parameter
none_have = false;
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
index 7684b3fd3f..8c98a4ff30 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
@@ -211,8 +211,7 @@ class PerformInteractionRequest
app_mngr::ApplicationSharedPtr app,
const size_t choice_set_id_list_length,
const smart_objects::SmartObject& choice_set_id_list) const;
-
-
+
/**
* @brief Checks each choice in each set for having a VRcommands parameter
* @param app contains pointer to application.
@@ -221,8 +220,7 @@ class PerformInteractionRequest
* @param choice_set_id_list array of choice set ids
* @return returns false request has choice sets with no vrCommands
*/
- bool CheckChoiceSetList_VRCommands(
- app_mngr::ApplicationSharedPtr app);
+ bool CheckChoiceSetList_VRCommands(app_mngr::ApplicationSharedPtr app);
/**
* @brief Tells if there are sent requests without responses
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 87f270d48a..0d6114cc50 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
@@ -118,18 +118,21 @@ void CreateInteractionChoiceSetRequest::Run() {
return;
}
-
Result::eType result = CheckChoiceSet(app);
if (Result::SUCCESS != result) {
SendResponse(false, result);
return;
}
- int vr_status = MessageHelper::CheckChoiceSet_VRCommands((*message_)[strings::msg_params][strings::choice_set]);
+ int vr_status = MessageHelper::CheckChoiceSet_VRCommands(
+ (*message_)[strings::msg_params][strings::choice_set]);
if (vr_status == -1) {
// this is an error
- SendResponse(false, Result::INVALID_DATA, "Some choices don't contain VR commands. Either all or none must have voice commands.");
- return; // exit now, this is a bad set
-
+ SendResponse(false,
+ Result::INVALID_DATA,
+ "Some choices don't contain VR commands. Either all or none "
+ "must have voice commands.");
+ return; // exit now, this is a bad set
+
} else if (vr_status == 0) {
// everyone had a vr command, setup the grammar
uint32_t grammar_id = application_manager_.GenerateGrammarID();
@@ -137,7 +140,7 @@ void CreateInteractionChoiceSetRequest::Run() {
}
// continue on as usual
app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]);
-
+
if (vr_status == 0) {
// we have VR commands
SendVRAddCommandRequests(app);
@@ -189,13 +192,15 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
bool CreateInteractionChoiceSetRequest::compareSynonyms(
const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1,
const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) {
- // only compare if they both have vr commands
+ // only compare if they both have vr commands
if (!(choice1.keyExists(strings::vr_commands) &&
choice2.keyExists(strings::vr_commands))) {
return false; // clearly there isn't a duplicate if one of them is null
}
- smart_objects::SmartArray* vr_cmds_1 = choice1[strings::vr_commands].asArray();
- smart_objects::SmartArray* vr_cmds_2 = choice2[strings::vr_commands].asArray();
+ smart_objects::SmartArray* vr_cmds_1 =
+ choice1[strings::vr_commands].asArray();
+ smart_objects::SmartArray* vr_cmds_2 =
+ choice2[strings::vr_commands].asArray();
smart_objects::SmartArray::iterator it;
it = std::find_first_of(vr_cmds_1->begin(),
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 98b5d96bb5..d013244f57 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
@@ -185,7 +185,8 @@ void PerformInteractionRequest::Run() {
case mobile_apis::InteractionMode::BOTH: {
LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH");
if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
- !CheckVrHelpItemPositions(app) || !CheckChoiceSetList_VRCommands(app)) {
+ !CheckVrHelpItemPositions(app) ||
+ !CheckChoiceSetList_VRCommands(app)) {
return;
}
break;
@@ -746,15 +747,15 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
size_t jj = 0;
for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) {
for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) {
- if (!((*i_choice_set)[strings::choice_set][ii].keyExists(
- strings::vr_commands) &&
- (*j_choice_set)[strings::choice_set][jj].keyExists(
- strings::vr_commands))) {
- LOG4CXX_DEBUG(
- logger_,
- "One or both sets has missing vr commands, skipping synonym check");
- return true;
- }
+ if (!((*i_choice_set)[strings::choice_set][ii].keyExists(
+ strings::vr_commands) &&
+ (*j_choice_set)[strings::choice_set][jj].keyExists(
+ strings::vr_commands))) {
+ LOG4CXX_DEBUG(logger_,
+ "One or both sets has missing vr commands, skipping "
+ "synonym check");
+ return true;
+ }
// choice_set pointer contains SmartObject msg_params
smart_objects::SmartObject& ii_vr_commands =
(*i_choice_set)[strings::choice_set][ii][strings::vr_commands];
@@ -951,11 +952,10 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
return false;
}
-
bool PerformInteractionRequest::CheckChoiceSetList_VRCommands(
ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
-
+
const smart_objects::SmartObject& choice_set_id_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
@@ -963,7 +963,7 @@ bool PerformInteractionRequest::CheckChoiceSetList_VRCommands(
for (size_t i = 0; i < choice_set_id_list.length(); ++i) {
choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
-
+
// this should never ever happen since this was already checked
if (choice_set == nullptr) {
LOG4CXX_ERROR(
@@ -971,12 +971,11 @@ bool PerformInteractionRequest::CheckChoiceSetList_VRCommands(
"Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
return false;
}
-
-
+
const smart_objects::SmartObject& choices_list =
(*choice_set)[strings::choice_set];
int vr_status = MessageHelper::CheckChoiceSet_VRCommands(choices_list);
-
+
// if not all choices have vr commands
if (vr_status != 0) {
LOG4CXX_ERROR(logger_,
@@ -1010,8 +1009,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest(
"Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
return false;
}
-
-
+
choice_list_length = (*choice_set)[strings::choice_set].length();
const smart_objects::SmartObject& choices_list =
(*choice_set)[strings::choice_set];
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index 349764b9e9..9066dc3a00 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -197,10 +197,10 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_vr = CreateFullParamsVRSO();
(*msg_vr)[strings::msg_params][strings::choice_set][0][strings::choice_id] =
10;
-(*msg_vr)[strings::msg_params][strings::choice_set][0][strings::menu_name] =
- "menu_name";
-(*msg_vr)[strings::msg_params][strings::choice_set][0][strings::vr_commands][0] =
- kVrCommands1;
+ (*msg_vr)[strings::msg_params][strings::choice_set][0][strings::menu_name] =
+ "menu_name";
+ (*msg_vr)[strings::msg_params][strings::choice_set][0][strings::vr_commands]
+ [0] = kVrCommands1;
(*msg_vr)[strings::msg_params][strings::interaction_choice_set_id] = 11;
std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr =
CreateCommand<CreateInteractionChoiceSetRequest>(msg_vr);