summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/message_helper/message_helper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/message_helper/message_helper.cc')
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc34
1 files changed, 34 insertions, 0 deletions
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 052d619fcc..0ad86b5541 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -2690,6 +2690,40 @@ mobile_apis::Result::eType MessageHelper::VerifyImage(
return mobile_apis::Result::WARNINGS;
}
+MessageHelper::ChoiceSetVRCommandsStatus
+MessageHelper::CheckChoiceSetVRCommands(
+ const smart_objects::SmartObject& choice_set) {
+ // if this is false, someone doesn't have vrCommands
+ bool all_have = true;
+ // if this is false, someone has vrCommands
+ bool none_have = true;
+ 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) {
+ // if the vrCommands is present
+ if (current_choice_set_it->keyExists(
+ application_manager::strings::vr_commands)) {
+ // this one has the parameter
+ none_have = false;
+ } else {
+ // this one doesn't
+ all_have = false;
+ }
+ }
+ // everyone has it
+ if (all_have) {
+ return MessageHelper::ChoiceSetVRCommandsStatus::ALL;
+ }
+ // No one has it
+ if (none_have) {
+ return MessageHelper::ChoiceSetVRCommandsStatus::NONE;
+ }
+ // mix-and-match
+ return MessageHelper::ChoiceSetVRCommandsStatus::MIXED;
+}
+
mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,