Skip to content

Commit

Permalink
Merge pull request #2927 from smartdevicelink/feature/add_media_servi…
Browse files Browse the repository at this point in the history
…ce_data_image

Add Parameter Media Service Data mediaImage
  • Loading branch information
Jack-Byrne authored Jun 7, 2019
2 parents 2026979 + cc0bbed commit 7a7c31b
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ extern const char* service_active;
extern const char* app_service_id;
extern const char* service_data;
extern const char* media_service_data;
extern const char* media_image;
extern const char* weather_service_data;
extern const char* location;
extern const char* current_forecast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class ASGetAppServiceDataRequestFromHMI
application_manager::ApplicationSharedPtr app);
void GetNavigationImagePaths(smart_objects::SmartObject& data,
application_manager::ApplicationSharedPtr app);
void GetMediaImagePaths(smart_objects::SmartObject& data,
application_manager::ApplicationSharedPtr app);
bool ValidateResponse(smart_objects::SmartObject& message_params);

DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestFromHMI);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class OnASAppServiceDataNotification
virtual void Run();

private:
void GetMediaImagePaths(smart_objects::SmartObject& data,
application_manager::ApplicationSharedPtr app);
void GetWeatherImagePaths(smart_objects::SmartObject& data,
application_manager::ApplicationSharedPtr app);
void GetNavigationImagePaths(smart_objects::SmartObject& data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ void ASGetAppServiceDataRequestFromHMI::GetNavigationImagePaths(
}
}

void ASGetAppServiceDataRequestFromHMI::GetMediaImagePaths(
smart_objects::SmartObject& data, ApplicationSharedPtr app) {
if (data.keyExists(strings::media_image)) {
MessageHelper::VerifyImage(
data[strings::media_image], app, application_manager_);
}
}

bool ASGetAppServiceDataRequestFromHMI::ValidateResponse(
smart_objects::SmartObject& message_params) {
if (!message_params.keyExists(strings::service_data)) {
Expand Down Expand Up @@ -215,6 +223,11 @@ bool ASGetAppServiceDataRequestFromHMI::ValidateResponse(
GetNavigationImagePaths(service_data[strings::navigation_service_data],
app);
}

if (service_type_value == mobile_apis::AppServiceType::MEDIA &&
service_data.keyExists(strings::media_service_data)) {
GetMediaImagePaths(service_data[strings::media_service_data], app);
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ OnASAppServiceDataNotification::OnASAppServiceDataNotification(

OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {}

void OnASAppServiceDataNotification::GetMediaImagePaths(
smart_objects::SmartObject& data, ApplicationSharedPtr app) {
if (data.keyExists(strings::media_image)) {
MessageHelper::VerifyImage(
data[strings::media_image], app, application_manager_);
}
}

void OnASAppServiceDataNotification::GetWeatherImagePaths(
smart_objects::SmartObject& data, ApplicationSharedPtr app) {
if (data[strings::location].keyExists(strings::location_image)) {
Expand Down Expand Up @@ -186,6 +194,11 @@ bool OnASAppServiceDataNotification::ValidateParams(
GetNavigationImagePaths(service_data[strings::navigation_service_data],
app);
}

if (service_type_value == mobile_apis::AppServiceType::MEDIA &&
service_data.keyExists(strings::media_service_data)) {
GetMediaImagePaths(service_data[strings::media_service_data], app);
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ const char* service_active = "serviceActive";
const char* app_service_id = "appServiceId";
const char* service_data = "serviceData";
const char* media_service_data = "mediaServiceData";
const char* media_image = "mediaImage";
const char* weather_service_data = "weatherServiceData";
const char* location = "location";
const char* current_forecast = "currentForecast";
Expand Down
8 changes: 8 additions & 0 deletions src/components/interfaces/HMI_API.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3484,6 +3484,14 @@
Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
</description>
</param>

<param name="mediaImage" type="Common.Image" mandatory="false">
<description>
Music: The album art of the current track
Podcast: The podcast or chapter artwork of the current podcast episode
Audiobook: The book or chapter artwork of the current audiobook
</description>
</param>
</struct>

<struct name="WeatherServiceManifest">
Expand Down
9 changes: 8 additions & 1 deletion src/components/interfaces/MOBILE_API.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>

<interface name="SmartDeviceLink RAPI" version="5.1.0" minVersion="1.0" date="2019-03-19">
<interface name="SmartDeviceLink RAPI" version="5.2.0" minVersion="1.0" date="2019-03-19">
<enum name="Result" internal_scope="base" since="1.0">
<element name="SUCCESS">
<description>The request succeeded</description>
Expand Down Expand Up @@ -3830,6 +3830,13 @@
Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
</description>
</param>
<param name="mediaImage" type="Image" mandatory="false" since="5.2">
<description>
Music: The album art of the current track
Podcast: The podcast or chapter artwork of the current podcast episode
Audiobook: The book or chapter artwork of the current audiobook
</description>
</param>
</struct>

<struct name="WeatherServiceManifest" since="5.1">
Expand Down

0 comments on commit 7a7c31b

Please sign in to comment.