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.cc24
1 files changed, 14 insertions, 10 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 ba1c726415..52da15af42 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -3365,16 +3365,20 @@ void MessageHelper::SubscribeApplicationToSoftButton(
ApplicationSharedPtr app,
int32_t function_id,
const WindowID window_id) {
- SoftButtonID softbuttons_id;
- smart_objects::SmartObject& soft_buttons =
- message_params[strings::soft_buttons];
- unsigned int length = soft_buttons.length();
- for (unsigned int i = 0; i < length; ++i) {
- const auto button_id = std::make_pair(
- soft_buttons[i][strings::soft_button_id].asUInt(), window_id);
- softbuttons_id.insert(button_id);
- }
- app->SubscribeToSoftButtons(function_id, softbuttons_id);
+ if (!message_params.keyExists(strings::soft_buttons)) {
+ return;
+ }
+
+ std::set<uint32_t> soft_buttons;
+
+ auto& soft_buttons_so = message_params[strings::soft_buttons];
+ for (const auto& softbutton : *(soft_buttons_so.asArray())) {
+ const auto button_id = softbutton[strings::soft_button_id].asUInt();
+ soft_buttons.insert(button_id);
+ }
+
+ WindowSoftButtons window_buttons{window_id, soft_buttons};
+ app->SubscribeToSoftButtons(function_id, window_buttons);
}
void MessageHelper::SubscribeApplicationToSoftButton(