summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShobhit Adlakha <ShobhitAd@users.noreply.github.com>2021-01-27 12:51:07 -0500
committerGitHub <noreply@github.com>2021-01-27 12:51:07 -0500
commit81428f49668f4c23529a593abbde1876886099c8 (patch)
treeb3177ebda7e7fea3bccb44e4067b3758784b9da7
parent61ea4ef6d64308e42dfbb93b61386991f193035b (diff)
downloadsdl_core-81428f49668f4c23529a593abbde1876886099c8.tar.gz
Feature/Media Skip Indicators (#3605)
* Add new param and struct in HMI API * Validate forward and back indicator params * Add info for INVALID_DATA response * Address review comment * Update RPC spec submodule commit
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc43
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc3
-rw-r--r--src/components/interfaces/HMI_API.xml23
m---------tools/rpc_spec0
6 files changed, 68 insertions, 6 deletions
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index c96c9ebe69..7498a0cc08 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -171,6 +171,9 @@ extern const char* minutes;
extern const char* seconds;
extern const char* update_mode;
extern const char* audioStreamingIndicator;
+extern const char* seek_time;
+extern const char* forward_seek_indicator;
+extern const char* back_seek_indicator;
extern const char* trigger_source;
extern const char* hmi_level;
extern const char* activate_app_hmi_level;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
index adced13d73..3023bf4fec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
@@ -74,7 +74,7 @@ class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl {
void on_event(const app_mngr::event_engine::Event& event);
private:
- bool isDataValid();
+ bool isDataValid(std::string& info);
DISALLOW_COPY_AND_ASSIGN(SetMediaClockRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
index cf5d80ecc0..285118749a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
@@ -37,6 +37,7 @@
#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -76,7 +77,8 @@ void SetMediaClockRequest::Run() {
return;
}
- if (isDataValid()) {
+ std::string info;
+ if (isDataValid(info)) {
// copy entirely msg
smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
msg_params[strings::app_id] = app->app_id();
@@ -85,7 +87,9 @@ void SetMediaClockRequest::Run() {
SendHMIRequest(
hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true);
} else {
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ info.empty() ? NULL : info.c_str());
}
}
@@ -117,7 +121,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) {
}
}
-bool SetMediaClockRequest::isDataValid() {
+bool SetMediaClockRequest::isDataValid(std::string& info) {
smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
mobile_apis::UpdateMode::eType update_mode =
static_cast<mobile_apis::UpdateMode::eType>(
@@ -126,7 +130,10 @@ bool SetMediaClockRequest::isDataValid() {
if (update_mode == mobile_apis::UpdateMode::COUNTUP ||
update_mode == mobile_apis::UpdateMode::COUNTDOWN) {
if (!msg_params.keyExists(strings::start_time)) {
- SDL_LOG_INFO("Invalid data");
+ info =
+ "Start time must be provided for \"COUNTUP\" and \"COUNTDOWN\" "
+ "update modes";
+ SDL_LOG_INFO("Invalid data: " << info);
return false;
}
@@ -151,7 +158,33 @@ bool SetMediaClockRequest::isDataValid() {
(update_mode == mobile_apis::UpdateMode::COUNTDOWN)) ||
((end_time_in_seconds < start_time_in_seconds) &&
(update_mode == mobile_apis::UpdateMode::COUNTUP))) {
- SDL_LOG_INFO("Invalid data");
+ std::string update_mode_name;
+ smart_objects::EnumConversionHelper<
+ mobile_apis::UpdateMode::eType>::EnumToString(update_mode,
+ &update_mode_name);
+ info = "Start time must be " +
+ std::string((update_mode == mobile_apis::UpdateMode::COUNTUP)
+ ? "before"
+ : "after") +
+ " the end time for update mode " + update_mode_name;
+ SDL_LOG_INFO("Invalid data: " << info);
+ return false;
+ }
+ }
+ }
+
+ std::vector<std::string> indicator_keys{strings::forward_seek_indicator,
+ strings::back_seek_indicator};
+ for (auto& key : indicator_keys) {
+ if (msg_params.keyExists(key)) {
+ mobile_apis::SeekIndicatorType::eType seek_indicator_type =
+ static_cast<mobile_apis::SeekIndicatorType::eType>(
+ msg_params[key][strings::type].asUInt());
+ if (seek_indicator_type == mobile_apis::SeekIndicatorType::TRACK &&
+ msg_params[key].keyExists(strings::seek_time)) {
+ info =
+ "The seekTime parameter is not applicable for indicator type TRACK";
+ SDL_LOG_INFO("Invalid data: " << info);
return false;
}
}
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index f95476b7a6..e78a14939f 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -138,6 +138,9 @@ const char* minutes = "minutes";
const char* seconds = "seconds";
const char* update_mode = "updateMode";
const char* audioStreamingIndicator = "audioStreamingIndicator";
+const char* seek_time = "seekTime";
+const char* forward_seek_indicator = "forwardSeekIndicator";
+const char* back_seek_indicator = "backSeekIndicator";
const char* trigger_source = "triggerSource";
const char* hmi_level = "hmiLevel";
const char* activate_app_hmi_level = "level";
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 2e4cd2a9dc..a5c08d8793 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -4349,6 +4349,23 @@
</param>
</struct>
+ <enum name="SeekIndicatorType">
+ <element name="TRACK" />
+ <element name="TIME" />
+ </enum>
+
+ <struct name="SeekStreamingIndicator">
+ <description>
+ The seek next / skip previous subscription buttons' content
+ </description>
+ <param name="type" type="SeekIndicatorType" mandatory="true" />
+ <param name="seekTime" type="Integer" minvalue="1" maxvalue="99" mandatory="false">
+ <description>
+ If the type is TIME, this number of seconds may be present alongside the skip indicator.
+ It will indicate the number of seconds that the currently playing media will skip forward or backward.
+ </description>
+ </param>
+ </struct>
</interface>
<interface name="Buttons" version="1.3.0" date="2017-07-18">
@@ -5590,6 +5607,12 @@
<param name="audioStreamingIndicator" type="Common.AudioStreamingIndicator" mandatory="false">
<description>Indicates that a button press of the Play/Pause button would play, pause or Stop the current playback.</description>
</param>
+ <param name="forwardSeekIndicator" type="Common.SeekStreamingIndicator" mandatory="false">
+ <description>Used to control the forward seek button to either skip forward a set amount of time or to the next track.</description>
+ </param>
+ <param name="backSeekIndicator" type="Common.SeekStreamingIndicator" mandatory="false">
+ <description>Used to control the backward seek button to either skip back a set amount of time or to the previous track.</description>
+ </param>
<param name="countRate" type="Float" minvalue="0.1" maxvalue="100.0" defvalue="1.0" mandatory="false">
<description>
The value of this parameter is the amount that the media clock timer will advance per 1.0 seconds of real time.
diff --git a/tools/rpc_spec b/tools/rpc_spec
-Subproject 4e6fc2963cdeab82e254315046954a26089f9f8
+Subproject 0110478f9c7ab7f87d526ef194dfa7ef156d2c5