summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleh Herasym (GitHub) <oolleehh@gmail.com>2016-08-25 15:50:55 +0300
committerAnton Hrytsevich (GitHub) <AGritsevich@users.noreply.github.com>2016-08-25 15:50:55 +0300
commitc201c11a35d360c0b96f36b103a2590bfaeb6026 (patch)
tree668625cd26f99d614765a2fa71f814d602fb7fcf
parent94871d7362972e61e9e123d61108d06fd143b827 (diff)
downloadsdl_core-c201c11a35d360c0b96f36b103a2590bfaeb6026.tar.gz
Conditions to transfer on button press on button event (#775)
* Fix OnButtonPress&OnButtonEvent description Related: APPLINK-25470 * Change conditions to transfer OnButtonEvent Related: APPLINK-25470 * Change conditions to transfer OnButtonPress Related: APPLINK-25470
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_event_notification.cc31
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_press_notification.cc31
-rw-r--r--src/components/interfaces/HMI_API.xml14
3 files changed, 39 insertions, 37 deletions
diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
index 5f14ad953f..b2ed8f8bfc 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
@@ -57,10 +57,16 @@ void OnButtonEventNotification::Run() {
static_cast<uint32_t>(
(*message_)[strings::msg_params][hmi_response::button_name].asInt());
+ const bool is_app_id_exists =
+ (*message_)[strings::msg_params].keyExists(strings::app_id);
+ const ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
+
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) {
+ if (!is_app_id_exists) {
LOG4CXX_ERROR_EXT(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id.");
return;
}
@@ -73,10 +79,7 @@ void OnButtonEventNotification::Run() {
return;
}
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
-
- if (false == app.valid()) {
+ if (!app) {
LOG4CXX_ERROR_EXT(logger_, "Application doesn't exist.");
return;
}
@@ -95,31 +98,27 @@ void OnButtonEventNotification::Run() {
return;
}
- const std::vector<ApplicationSharedPtr>& subscribedApps =
+ const std::vector<ApplicationSharedPtr>& subscribed_apps =
ApplicationManagerImpl::instance()->applications_by_button(btn_id);
- std::vector<ApplicationSharedPtr>::const_iterator it = subscribedApps.begin();
- for (; subscribedApps.end() != it; ++it) {
+ std::vector<ApplicationSharedPtr>::const_iterator it = subscribed_apps.begin();
+ for (; subscribed_apps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
LOG4CXX_WARN_EXT(logger_, "Null pointer to subscribed app.");
continue;
}
- //Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode
+ // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode
if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
(mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
LOG4CXX_WARN_EXT(logger_, "OnButtonEvent in HMI_BACKGROUND or NONE");
continue;
}
-
- //Send ButtonEvent notification for OK button only in HMI_FULL mode
- if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) &&
- (!subscribed_app->IsFullscreen())) {
- continue;
+ // if "app_id" absent send notification only in HMI_FULL mode
+ if (is_app_id_exists || subscribed_app->IsFullscreen()) {
+ SendButtonEvent(subscribed_app);
}
-
- SendButtonEvent(subscribed_app);
}
}
diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
index 86fe664f86..72677c0f77 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
@@ -57,10 +57,16 @@ void OnButtonPressNotification::Run() {
static_cast<uint32_t>(
(*message_)[strings::msg_params][hmi_response::button_name].asInt());
+ const bool is_app_id_exists =
+ (*message_)[strings::msg_params].keyExists(strings::app_id);
+ const ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
+
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) {
+ if (!is_app_id_exists) {
LOG4CXX_ERROR_EXT(logger_, "CUSTOM_BUTTON OnButtonPress without app_id.");
return;
}
@@ -73,10 +79,7 @@ void OnButtonPressNotification::Run() {
return;
}
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
-
- if (false == app.valid()) {
+ if (!app) {
LOG4CXX_ERROR_EXT(logger_, "Application doesn't exist.");
return;
}
@@ -95,31 +98,27 @@ void OnButtonPressNotification::Run() {
return;
}
- const std::vector<ApplicationSharedPtr>& subscribedApps =
+ const std::vector<ApplicationSharedPtr>& subscribed_apps =
ApplicationManagerImpl::instance()->applications_by_button(btn_id);
- std::vector<ApplicationSharedPtr>::const_iterator it = subscribedApps.begin();
- for (; subscribedApps.end() != it; ++it) {
+ std::vector<ApplicationSharedPtr>::const_iterator it = subscribed_apps.begin();
+ for (; subscribed_apps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
LOG4CXX_WARN_EXT(logger_, "Null pointer to subscribed app.");
continue;
}
- //Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
+ // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
(mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
LOG4CXX_WARN_EXT(logger_, "OnButtonPress in HMI_BACKGROUND or NONE");
continue;
}
-
- //Send ButtonPress notification for OK button only in HMI_FULL mode
- if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) &&
- (mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) {
- continue;
+ // if "app_id" absent send notification only in HMI_FULL mode
+ if (is_app_id_exists || subscribed_app->IsFullscreen()) {
+ SendButtonPress(subscribed_app);
}
-
- SendButtonPress(subscribed_app);
}
}
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 6b093505b7..7bc099ac7f 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -1938,7 +1938,7 @@
</interface>
-<interface name="Buttons" version="1.0" date="2013-04-12">
+<interface name="Buttons" version="1.1" date="2016-08-18">
<function name="GetCapabilities" messagetype="request">
<description>Method is invoked at system start-up. SDL requests the information about all supported hardware buttons and their capabilities</description>
</function>
@@ -1961,8 +1961,10 @@
</param>
<param name="appID" type="Integer" mandatory="false">
<description>
- In case the ButtonName is CUSTOM_BUTTON, HMI must include appID parameters to OnButtonPress notification sent to SDL.
- Otherwise, if appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
+ In case the ButtonName is CUSTOM_BUTTON or OK, HMI must include appID parameters to OnButtonPress notification sent to SDL.
+ If appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
+ If appID is present for OK button -> SDL transfers notification to the named app only if it is in FULL or LIMITED (ignores if app is in NONE or BACKGROUND).
+ If appID is omited for OK button -> SDL transfers notification to app in FULL
</description>
</param>
</function>
@@ -1976,8 +1978,10 @@
</param>
<param name="appID" type="Integer" mandatory="false">
<description>
- In case the ButtonName is CUSTOM_BUTTON, HMI must include appID parameters to OnButtonEvent notification sent to SDL.
- Otherwise, if appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
+ In case the ButtonName is CUSTOM_BUTTON or OK, HMI must include appID parameters to OnButtonEvent notification sent to SDL.
+ If appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
+ If appID is present for OK button -> SDL transfers notification to the named app only if it is in FULL or LIMITED (ignores if app is in NONE or BACKGROUND).
+ If appID is omited for OK button -> SDL transfers notification to app in FULL
</description>
</param>
</function>