summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2018-08-28 15:21:58 -0400
committerGitHub <noreply@github.com>2018-08-28 15:21:58 -0400
commit49841afec293e7f7162cf5ea16df0593cb7dbce6 (patch)
tree6121d0d6510208cac442ac6e1a84bdc2e4c76dc7
parent70522acade78043f5c08c3f73af9793312cef000 (diff)
parent721fcfec20f26ff86dcbd652d12e7cc26e355b7f (diff)
downloadsdl_core-feature/3rd_party_travis_cache.tar.gz
Merge branch 'develop' into feature/3rd_party_travis_cachefeature/3rd_party_travis_cache
-rwxr-xr-xsrc/appMain/hmi_capabilities.json98
-rw-r--r--src/appMain/life_cycle_impl.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h13
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h7
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc414
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h76
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h91
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc149
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc51
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc2
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc8
-rw-r--r--src/components/application_manager/test/hmi_capabilities.json6
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc2
-rw-r--r--src/components/include/utils/date_time.h2
-rw-r--r--src/components/include/utils/semantic_version.h3
-rw-r--r--src/components/interfaces/HMI_API.xml35
-rw-r--r--src/components/interfaces/Json_HMI_message_specification.txt7
-rw-r--r--src/components/interfaces/MOBILE_API.xml44
-rw-r--r--src/components/utils/include/utils/log_message_loop_thread.h10
-rw-r--r--src/components/utils/src/date_time.cc5
-rw-r--r--src/components/utils/src/log_message_loop_thread.cc7
-rw-r--r--src/components/utils/src/logger.cc3
-rw-r--r--src/components/utils/src/semantic_version.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_icon_request.cc)36
-rw-r--r--src/components/utils/test/log_message_loop_thread_test.cc2
-rw-r--r--tools/intergen/test/test_hmi_interface.xml1
39 files changed, 744 insertions, 749 deletions
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index a3f7bcd0a1..93292d1023 100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -504,204 +504,292 @@
"moduleName": "light",
"supportedLights":[
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_LEFT_HIGH_BEAM",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_RIGHT_HIGH_BEAM",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_LEFT_LOW_BEAM",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_RIGHT_LOW_BEAM",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_LEFT_PARKING_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_RIGHT_PARKING_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_LEFT_FOG_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_RIGHT_FOG_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_LEFT_DAYTIME_RUNNING_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_RIGHT_DAYTIME_RUNNING_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_LEFT_TURN_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FRONT_RIGHT_TURN_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_LEFT_FOG_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_RIGHT_FOG_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_LEFT_TAIL_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_RIGHT_TAIL_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
- "name":"REAR_LEFT_BREAK_LIGHT",
+ "name":"REAR_LEFT_BRAKE_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
- "name":"REAR_RIGHT_BREAK_LIGHT",
+ "name":"REAR_RIGHT_BRAKE_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_LEFT_TURN_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_RIGHT_TURN_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_REGISTRATION_PLATE_LIGHT",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"HIGH_BEAMS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"LOW_BEAMS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"FOG_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"RUNNING_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"PARKING_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"BRAKE_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"REAR_REVERSING_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"SIDE_MARKER_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"LEFT_TURN_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"RIGHT_TURN_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"HAZARD_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"AMBIENT_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"OVERHEAD_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"READING_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"TRUNK_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"EXTERIOR_FRONT_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"EXTERIOR_REAR_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"EXTERIOR_LEFT_LIGHTS",
"rgbColorSpaceAvailable":true
},
{
+ "statusAvailable":true,
"densityAvailable":true,
"name":"EXTERIOR_RIGHT_LIGHTS",
"rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"REAR_CARGO_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"REAR_TRUCK_BED_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"REAR_TRAILER_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"LEFT_SPOT_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"RIGHT_SPOT_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"LEFT_PUDDLE_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"RIGHT_PUDDLE_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":false,
+ "name":"EXTERIOR_ALL_LIGHTS",
+ "rgbColorSpaceAvailable":false
}
]
},
@@ -798,6 +886,12 @@
"upDownAvailable": true
},
{
+ "name":"PLAY_PAUSE",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
"name": "SEEKLEFT",
"shortPressAvailable": true,
"longPressAvailable": true,
diff --git a/src/appMain/life_cycle_impl.cc b/src/appMain/life_cycle_impl.cc
index 186be3c829..b87191d937 100644
--- a/src/appMain/life_cycle_impl.cc
+++ b/src/appMain/life_cycle_impl.cc
@@ -163,7 +163,10 @@ bool LifeCycleImpl::StartComponents() {
// It's important to initialise TM after setting up listener chain
// [TM -> CH -> AM], otherwise some events from TM could arrive at nowhere
app_manager_->set_protocol_handler(protocol_handler_);
- transport_manager_->Init(*last_state_);
+ if (transport_manager::E_SUCCESS != transport_manager_->Init(*last_state_)) {
+ LOG4CXX_ERROR(logger_, "Transport manager init failed.");
+ return false;
+ }
// start transport manager
transport_manager_->Visibility(true);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h
index d5de4981c6..128c668ee9 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h
@@ -39,6 +39,11 @@ namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
+
+enum capabilitiesStatus { success, missedLightName, missedParam, readOnly };
+
+typedef std::pair<std::string, capabilitiesStatus> ModuleCapability;
+
class SetInteriorVehicleDataRequest : public RCCommandRequest {
public:
SetInteriorVehicleDataRequest(
@@ -81,10 +86,12 @@ class SetInteriorVehicleDataRequest : public RCCommandRequest {
/**
* @brief Method that check if READ_ONLY parameters present
- * @param request_params params from received message
+ * @param request_params params from received message,
+ * @param module_data_capabilities info for notification to mobile
* @return true if present , false - otherwise
*/
- bool AreReadOnlyParamsPresent(const smart_objects::SmartObject& module_data);
+ bool AreReadOnlyParamsPresent(const smart_objects::SmartObject& module_data,
+ ModuleCapability& module_data_capabilities);
/**
* @brief Method that check if all request parameters are READ_ONLY
@@ -95,7 +102,7 @@ class SetInteriorVehicleDataRequest : public RCCommandRequest {
/**
* @brief Method that cuts-off READ_ONLY parameters
- * @param request_params params to handle
+ * @param module_data params to handle
*/
void CutOffReadOnlyParams(smart_objects::SmartObject& module_data);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
index e80507445b..1951af1a24 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
@@ -52,6 +52,7 @@ const char kSupportedLights[] = "supportedLights";
// LightControlCapabilities
const char kName[] = "name";
+const char kStatusAvailable[] = "statusAvailable";
const char kDensityAvailable[] = "densityAvailable";
const char kRGBColorSpaceAvailable[] = "rgbColorSpaceAvailable";
@@ -178,9 +179,9 @@ const char kHeatedMirrorsEnable[] = "heatedMirrorsEnable";
// LightControlData
const char kLightState[] = "lightState";
-const char kStatus[] = "status";
-const char kDensity[] = "density";
-const char kColor[] = "color";
+const char kLightStatus[] = "status";
+const char kLightDensity[] = "density";
+const char kLightColor[] = "color";
// AudioControlData
const char kSource[] = "source";
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
index b67e3e2553..91cb6cb7ee 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
@@ -89,14 +89,6 @@ std::string AccessModeToString(
void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() {
LOG4CXX_AUTO_TRACE(logger_);
- typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
- Apps apps = RCRPCPlugin::GetRCApplications(application_manager_);
- for (Apps::iterator it = apps.begin(); it != apps.end(); ++it) {
- application_manager::ApplicationSharedPtr app = *it;
- DCHECK(app);
- application_manager_.ChangeAppsHMILevel(
- app->app_id(), mobile_apis::HMILevel::eType::HMI_NONE);
- }
interior_data_manager_.OnDisablingRC();
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
index 17a492b5aa..e6f19a889c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
@@ -59,10 +59,22 @@ std::vector<std::string> GetModuleReadOnlyParams(
module_ro_params.push_back(kSignalChangeThreshold);
module_ro_params.push_back(kState);
module_ro_params.push_back(kSisData);
+ } else if (enums_value::kLight == module_type) {
+ module_ro_params.push_back(kLightStatus);
}
+
return module_ro_params;
}
+const std::map<std::string, std::string> GetLightCapabilitiesMapping() {
+ std::map<std::string, std::string> mapping = {
+ {message_params::kId, strings::kName},
+ {message_params::kLightStatus, strings::kStatusAvailable},
+ {message_params::kLightDensity, strings::kDensityAvailable},
+ {message_params::kLightColor, strings::kRGBColorSpaceAvailable}};
+ return mapping;
+}
+
const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() {
std::map<std::string, std::string> mapping;
// climate
@@ -113,6 +125,7 @@ const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() {
mapping["massageMode"] = "massageModeAvailable";
mapping["massageCushionFirmness"] = "massageCushionFirmnessAvailable";
mapping["memory"] = "memoryAvailable";
+
// audio
mapping["source"] = "sourceAvailable";
mapping["keepContext"] = "keepContextAvailable";
@@ -146,45 +159,98 @@ const std::string LightName(const smart_objects::SmartObject& light_name) {
return ok ? name : "unknown";
}
-bool CheckLightDataByCapabilities(
+/**
+ * @brief Check whether the parameter exist in capabilities
+ * @param smart object of capabilities
+ * @param mapping - map of module data and capabilities
+ * @param request_parameter - string
+ * @param switched_off_result - ref of mobile_apis::Result
+ * @return success if parameter exist in capabilities missedParam otherwise
+ */
+capabilitiesStatus GetItemCapability(
const smart_objects::SmartObject& capabilities,
- const smart_objects::SmartObject& light_data) {
+ const std::map<std::string, std::string>& mapping,
+ const std::string& request_parameter,
+ const mobile_apis::Result::eType& switched_off_result) {
+ const auto it = mapping.find(request_parameter);
+
+ if (it == mapping.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Parameter " << request_parameter
+ << " doesn't exist in capabilities.");
+ return capabilitiesStatus::missedParam;
+ }
+
+ const std::string& caps_key = it->second;
+
+ LOG4CXX_DEBUG(logger_,
+ "Checking request parameter "
+ << request_parameter
+ << " with capabilities. Appropriate key is " << caps_key);
+
+ if (!capabilities.keyExists(caps_key)) {
+ LOG4CXX_DEBUG(logger_,
+ "Capability " << caps_key
+ << " is missed in RemoteControl capabilities");
+ return capabilitiesStatus::missedParam;
+ }
+
+ if (!capabilities[caps_key].asBool()) {
+ LOG4CXX_DEBUG(logger_,
+ "Capability "
+ << caps_key
+ << " is switched off in RemoteControl capabilities");
+ capabilitiesStatus status = capabilitiesStatus::missedParam;
+ if (mobile_apis::Result::READ_ONLY == switched_off_result) {
+ status = capabilitiesStatus::readOnly;
+ }
+ return status;
+ }
+
+ return capabilitiesStatus::success;
+}
+
+/**
+ * @brief Check whether the cpabilities for light allowed
+ * @param smart object of capabilities
+ * @param smart object of control_data
+ * @return pair of state and capability status - ModuleCapability
+ */
+ModuleCapability GetLightDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
+ const smart_objects::SmartObject& control_data) {
LOG4CXX_AUTO_TRACE(logger_);
- std::map<std::string, std::string> lightCapsMapping = {
- {message_params::kId, strings::kName},
- {message_params::kDensity, strings::kDensityAvailable},
- {message_params::kColor, strings::kRGBColorSpaceAvailable}};
- auto it = light_data.map_begin();
- for (; it != light_data.map_end(); ++it) {
- if (message_params::kStatus == it->first ||
- message_params::kId == it->first) {
+ std::map<std::string, std::string> mapping = GetLightCapabilitiesMapping();
+
+ for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) {
+ const std::string& request_parameter = it->first;
+
+ if (message_params::kId == request_parameter) {
continue;
}
- const std::string& caps_key = lightCapsMapping[it->first];
- LOG4CXX_DEBUG(logger_,
- "Checking request parameter "
- << it->first << " with capabilities. Appropriate key is "
- << caps_key);
-
- if (!capabilities.keyExists(caps_key)) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is missed in RemoteControl capabilities");
- return false;
- }
- if (!capabilities[caps_key].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is switched off in RemoteControl capabilities");
- return false;
+
+ const capabilitiesStatus status_item_capability =
+ GetItemCapability(capabilities,
+ mapping,
+ request_parameter,
+ mobile_apis::Result::READ_ONLY);
+
+ if (capabilitiesStatus::success != status_item_capability) {
+ return std::make_pair(message_params::kLightState,
+ status_item_capability);
}
}
- return true;
+
+ return std::make_pair("", capabilitiesStatus::success);
}
-bool CheckLightNameByCapabilities(
+/**
+ * @brief Check whether the light name exists in capabilities
+ * @param smart object of capabilities_status
+ * @param smart object of light_data
+ * @return pair of state and capability status - ModuleCapability
+ */
+ModuleCapability GetLightNameCapabilities(
const smart_objects::SmartObject& capabilities_status,
const smart_objects::SmartObject& light_data) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -193,90 +259,101 @@ bool CheckLightNameByCapabilities(
const smart_objects::SmartObject& so = *it;
const int64_t current_id = so[message_params::kName].asInt();
if (current_id == light_data[message_params::kId].asInt()) {
- return CheckLightDataByCapabilities(so, light_data);
+ return GetLightDataCapabilities(so, light_data);
}
}
LOG4CXX_DEBUG(logger_, "There is no such light name in capabilities");
- return false;
-}
-
-bool CheckRadioBandByCapabilities(
- const smart_objects::SmartObject& capabilities_status,
- const smart_objects::SmartObject& request_parameter) {
- mobile_apis::RadioBand::eType radio_band =
- static_cast<mobile_apis::RadioBand::eType>(request_parameter.asUInt());
- if (mobile_apis::RadioBand::XM == radio_band) {
- if (!capabilities_status.keyExists(strings::kSiriusxmRadioAvailable)) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << strings::kSiriusxmRadioAvailable
- << " is missed in RemoteControl capabilities");
- return false;
- }
- if (!capabilities_status[strings::kSiriusxmRadioAvailable].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << strings::kSiriusxmRadioAvailable
- << " is switched off in RemoteControl capabilities");
- return false;
- }
- }
- return true;
+ return std::make_pair(message_params::kLightState,
+ capabilitiesStatus::missedLightName);
}
-bool CheckControlDataByCapabilities(
- const smart_objects::SmartObject& capabilities_status,
+/**
+ * @brief Check whether the exists light data related to correspondent
+ * capabilities
+ * @param smart object of capabilities
+ * @param smart object of control_data
+ * @return pair of state and capability status - ModuleCapability
+ */
+ModuleCapability GetControlDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
const smart_objects::SmartObject& control_data) {
LOG4CXX_AUTO_TRACE(logger_);
std::map<std::string, std::string> mapping =
GetModuleDataToCapabilitiesMapping();
- auto it = control_data.map_begin();
- for (; it != control_data.map_end(); ++it) {
+
+ for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) {
const std::string& request_parameter = it->first;
if (message_params::kId == request_parameter) {
continue;
}
if (message_params::kLightState == request_parameter) {
auto light_data = control_data[request_parameter].asArray()->begin();
+ ModuleCapability light_capability =
+ std::make_pair("", capabilitiesStatus::success);
+
for (; light_data != control_data[request_parameter].asArray()->end();
++light_data) {
- if (!CheckLightNameByCapabilities(
- capabilities_status[strings::kSupportedLights], *light_data)) {
- return false;
+ light_capability = GetLightNameCapabilities(
+ capabilities[strings::kSupportedLights], *light_data);
+
+ if (capabilitiesStatus::success != light_capability.second) {
+ return light_capability;
}
}
- return true;
- }
- const std::string& caps_key = mapping[request_parameter];
- LOG4CXX_DEBUG(logger_,
- "Checking request parameter "
- << request_parameter
- << " with capabilities. Appropriate key is " << caps_key);
-
- if (!capabilities_status.keyExists(caps_key)) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is missed in RemoteControl capabilities");
- return false;
+
+ return light_capability;
}
- if (!capabilities_status[caps_key].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is switched off in RemoteControl capabilities");
- return false;
+
+ const capabilitiesStatus status_item_capability =
+ GetItemCapability(capabilities[0],
+ mapping,
+ request_parameter,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
+
+ if (capabilitiesStatus::success != status_item_capability) {
+ return std::make_pair("", status_item_capability);
}
- if (message_params::kBand == request_parameter &&
- !CheckRadioBandByCapabilities(capabilities_status,
- control_data[request_parameter])) {
- return false;
+ }
+
+ return std::make_pair("", capabilitiesStatus::success);
+}
+
+/**
+ * @brief Check whether the exists hmi data related to correspondent
+ * capabilities
+ * @param smart object of capabilities
+ * @param smart object of control_data
+ * @return pair of state and capability status - ModuleCapability
+ */
+ModuleCapability GetHmiControlDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
+ const smart_objects::SmartObject& control_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::map<std::string, std::string> mapping =
+ GetModuleDataToCapabilitiesMapping();
+
+ for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) {
+ const capabilitiesStatus status_item_capability =
+ GetItemCapability(capabilities,
+ mapping,
+ it->first,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
+
+ if (capabilitiesStatus::success != status_item_capability) {
+ return std::make_pair("", status_item_capability);
}
}
- return true;
+
+ return std::make_pair("", capabilitiesStatus::success);
}
-bool CheckIfModuleDataExistInCapabilities(
+/**
+ * @brief Check whether rc module data capabilities are presented
+ * @param smart object of rc_capabilities
+ * @param smart object of module_data
+ * @return pair of state and capability status - ModuleCapability
+ */
+ModuleCapability GetModuleDataCapabilities(
const smart_objects::SmartObject& rc_capabilities,
const smart_objects::SmartObject& module_data) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -285,29 +362,31 @@ bool CheckIfModuleDataExistInCapabilities(
const auto& get_module_data_key = RCHelpers::GetModuleTypeToDataMapping();
const auto& get_capabilities_key =
RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ ModuleCapability module_data_capabilities =
+ std::make_pair("", capabilitiesStatus::missedParam);
- bool is_module_data_valid = false;
for (const auto& module_type : all_module_types) {
const auto module_data_key = get_module_data_key(module_type);
const auto capabilities_key = get_capabilities_key(module_type);
if (module_data.keyExists(module_data_key)) {
if (!rc_capabilities.keyExists(capabilities_key)) {
LOG4CXX_DEBUG(logger_, module_data_key << " capabilities not present");
- return false;
+ return module_data_capabilities;
}
const smart_objects::SmartObject& caps =
rc_capabilities[capabilities_key];
- if (message_params::kHmiSettingsControlData == module_data_key ||
- message_params::kLightControlData == module_data_key) {
- is_module_data_valid =
- CheckControlDataByCapabilities(caps, module_data[module_data_key]);
+
+ if (message_params::kHmiSettingsControlData == module_data_key) {
+ module_data_capabilities =
+ GetHmiControlDataCapabilities(caps, module_data[module_data_key]);
} else {
- is_module_data_valid = CheckControlDataByCapabilities(
- caps[0], module_data[module_data_key]);
+ module_data_capabilities =
+ GetControlDataCapabilities(caps, module_data[module_data_key]);
}
}
}
- return is_module_data_valid;
+
+ return module_data_capabilities;
}
bool isModuleTypeAndDataMatch(const std::string& module_type,
@@ -325,6 +404,35 @@ bool isModuleTypeAndDataMatch(const std::string& module_type,
return module_type_and_data_match;
}
+mobile_apis::Result::eType PrepareResultCodeAndInfo(
+ const ModuleCapability module_data_capabilities, std::string& info) {
+ mobile_apis::Result::eType result_code =
+ mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ if (message_params::kLightState == module_data_capabilities.first) {
+ switch (module_data_capabilities.second) {
+ case capabilitiesStatus::missedLightName:
+ info = "The requested LightName is not supported by the vehicle.";
+ break;
+ case capabilitiesStatus::missedParam:
+ info =
+ "The requested parameter of the given LightName is not supported "
+ "by the vehicle.";
+ break;
+ case capabilitiesStatus::readOnly:
+ info = "The requested parameter is read-only.";
+ result_code = mobile_apis::Result::READ_ONLY;
+ break;
+ default:
+ break;
+ }
+
+ } else {
+ info = "Accessing not supported module data.";
+ }
+ return result_code;
+ LOG4CXX_WARN(logger_, info);
+}
+
void SetInteriorVehicleDataRequest::Execute() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -335,15 +443,22 @@ void SetInteriorVehicleDataRequest::Execute() {
if (isModuleTypeAndDataMatch(module_type, module_data)) {
const smart_objects::SmartObject* rc_capabilities =
hmi_capabilities_.rc_capability();
- if (rc_capabilities &&
- !CheckIfModuleDataExistInCapabilities(*rc_capabilities, module_data)) {
- LOG4CXX_WARN(logger_, "Accessing not supported module data");
- SetResourceState(ModuleType(), ResourceState::FREE);
- SendResponse(false,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
- "Accessing not supported module data");
- return;
+ ModuleCapability module_data_capabilities;
+
+ if (rc_capabilities) {
+ module_data_capabilities =
+ GetModuleDataCapabilities(*rc_capabilities, module_data);
+
+ if (capabilitiesStatus::success != module_data_capabilities.second) {
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ std::string info;
+ mobile_apis::Result::eType result =
+ PrepareResultCodeAndInfo(module_data_capabilities, info);
+ SendResponse(false, result, info.c_str());
+ return;
+ }
}
+
if (AreAllParamsReadOnly(module_data)) {
LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!");
SetResourceState(ModuleType(), ResourceState::FREE);
@@ -352,11 +467,27 @@ void SetInteriorVehicleDataRequest::Execute() {
"All request params in module type are READ ONLY!");
return;
}
- if (AreReadOnlyParamsPresent(module_data)) {
+
+ module_data_capabilities = std::make_pair("", capabilitiesStatus::success);
+
+ if (AreReadOnlyParamsPresent(module_data, module_data_capabilities)) {
LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters");
+
+ if (enums_value::kLight == module_data_capabilities.first &&
+ capabilitiesStatus::success != module_data_capabilities.second) {
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ SendResponse(
+ false,
+ mobile_apis::Result::READ_ONLY,
+ "The LightStatus enum passed is READ ONLY and cannot be written.");
+ return;
+ }
+
LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameters... ");
+
CutOffReadOnlyParams(module_data);
}
+
application_manager_.RemoveHMIFakeParameters(message_);
app_mngr::ApplicationSharedPtr app =
@@ -478,6 +609,8 @@ bool SetInteriorVehicleDataRequest::AreAllParamsReadOnly(
return false;
}
}
+
+ LOG4CXX_DEBUG(logger_, "All params are ReadOnly");
return true;
}
@@ -487,33 +620,84 @@ bool CheckReadOnlyParamsForAudio(
const auto& equalizer_settings =
module_type_params[message_params::kEqualizerSettings];
auto it = equalizer_settings.asArray()->begin();
+
for (; it != equalizer_settings.asArray()->end(); ++it) {
if (it->keyExists(message_params::kChannelName)) {
LOG4CXX_DEBUG(logger_,
- " READ ONLY parameter: " << message_params::kChannelName);
+ "READ ONLY parameter. ChannelName = "
+ << (*it)[message_params::kChannelName].asString());
return true;
}
}
}
+
+ return false;
+}
+
+bool CheckReadOnlyParamsForLight(
+ const smart_objects::SmartObject& module_type_params) {
+ if (module_type_params.keyExists(message_params::kLightState)) {
+ const auto& light_state = module_type_params[message_params::kLightState];
+ auto it = light_state.asArray()->begin();
+
+ for (; it != light_state.asArray()->end(); ++it) {
+ if (it->keyExists(message_params::kLightStatus)) {
+ const mobile_apis::LightStatus::eType light_status =
+ static_cast<mobile_apis::LightStatus::eType>(
+ (*it)[message_params::kLightStatus].asUInt());
+
+ if (helpers::Compare<mobile_apis::LightStatus::eType,
+ helpers::EQ,
+ helpers::ONE>(light_status,
+ mobile_apis::LightStatus::RAMP_UP,
+ mobile_apis::LightStatus::RAMP_DOWN,
+ mobile_apis::LightStatus::UNKNOWN,
+ mobile_apis::LightStatus::INVALID)) {
+ LOG4CXX_DEBUG(logger_,
+ "READ ONLY parameter. Status = "
+ << (*it)[message_params::kLightStatus].asInt());
+ return true;
+ }
+ }
+ }
+ }
+
return false;
}
bool SetInteriorVehicleDataRequest::AreReadOnlyParamsPresent(
- const smart_objects::SmartObject& module_data) {
+ const smart_objects::SmartObject& module_data,
+ ModuleCapability& module_data_capabilities) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& module_type_params =
ControlData(module_data);
- auto it = module_type_params.map_begin();
const std::string module_type = ModuleType();
- std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type);
+
if (enums_value::kAudio == module_type) {
return CheckReadOnlyParamsForAudio(module_type_params);
}
+
+ if (enums_value::kLight == module_type) {
+ const bool result = CheckReadOnlyParamsForLight(module_type_params);
+
+ if (result) {
+ module_data_capabilities =
+ std::make_pair(module_type, capabilitiesStatus::readOnly);
+ }
+
+ return result;
+ }
+
+ const std::vector<std::string> ro_params =
+ GetModuleReadOnlyParams(module_type);
+ auto it = module_type_params.map_begin();
+
for (; it != module_type_params.map_end(); ++it) {
if (helpers::in_range(ro_params, it->first)) {
return true;
}
}
+
return false;
}
@@ -529,11 +713,13 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
if (module_type_params.keyExists(it)) {
if (enums_value::kClimate == module_type) {
module_data[message_params::kClimateControlData].erase(it);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
} else if (enums_value::kRadio == module_type) {
module_data[message_params::kRadioControlData].erase(it);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
+ } else {
+ continue;
}
+
+ LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
}
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
index 164623d926..b95725e0b4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
@@ -139,22 +139,8 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest,
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kAllowed] = false;
- ApplicationSet app_set = {mock_app_};
-
- std::shared_ptr<sync_primitives::Lock> apps_lock =
- std::make_shared<sync_primitives::Lock>();
- DataAccessor<ApplicationSet> accessor(app_set, apps_lock);
- // Expectations
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
-
- RCAppExtensionPtr rc_extention_ptr =
- std::make_shared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
- rc_extention_ptr->SubscribeToInteriorVehicleData(enums_value::kClimate);
- ON_CALL(*mock_app_, QueryInterface(_))
- .WillByDefault(Return(rc_extention_ptr));
-
EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations());
+ EXPECT_CALL(mock_interior_data_manager_, OnDisablingRC());
// Act
std::shared_ptr<
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h
deleted file mode 100644
index 84c275ec5a..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_REQUEST_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_REQUEST_H_
-
-#include "application_manager/commands/request_to_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief UISetIconRequest command class
- **/
-class UISetIconRequest : public app_mngr::commands::RequestToHMI {
- public:
- /**
- * @brief UISetIconRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- UISetIconRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
-
- /**
- * @brief UISetIconRequest class destructor
- **/
- virtual ~UISetIconRequest();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(UISetIconRequest);
-};
-
-} // namespace commands
-
-} // namespace application_manager
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h
deleted file mode 100644
index 654dff25b5..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_RESPONSE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_RESPONSE_H_
-
-#include "application_manager/commands/response_from_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief UISetIconResponse command class
- **/
-class UISetIconResponse : public app_mngr::commands::ResponseFromHMI {
- public:
- /**
- * @brief UISetIconResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- UISetIconResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
-
- /**
- * @brief UISetIconResponse class destructor
- **/
- virtual ~UISetIconResponse();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(UISetIconResponse);
-};
-
-} // namespace commands
-
-} // namespace application_manager
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h
deleted file mode 100644
index f994f06ca3..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-
- Copyright (c) 2018, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
-
-#include "application_manager/commands/command_request_impl.h"
-#include "application_manager/application_manager.h"
-#include "utils/macro.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief SetIconRequest command class
- **/
-class SetIconRequest : public app_mngr::commands::CommandRequestImpl {
- public:
- /**
- * @brief Contains information about the type of image
- */
- typedef enum { STATIC = 0, DYNAMIC } ImageType;
-
- /**
- * @brief SetIconRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
- SetIconRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
-
- /**
- * @brief SetIconRequest class destructor
- **/
- virtual ~SetIconRequest();
-
- /**
- * @brief Interface method that is called whenever new event received
- *
- * @param event The received event
- */
- void on_event(const app_mngr::event_engine::Event& event);
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SetIconRequest);
-};
-
-} // namespace commands
-} // namespace application_manager
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h
deleted file mode 100644
index c83ea3607a..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-
- Copyright (c) 2018, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
-
-#include "application_manager/commands/command_response_impl.h"
-#include "application_manager/application_manager.h"
-#include "utils/macro.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-
-namespace commands {
-
-/**
- * @brief SetIconResponse command class
- **/
-class SetIconResponse : public app_mngr::commands::CommandResponseImpl {
- public:
- /**
- * @brief SetIconResponse class constructor
- *
- * @param message Incoming SmartObject message
- **/
- SetIconResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& app_man,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
-
- /**
- * @brief SetIconResponse class destructor
- **/
- virtual ~SetIconResponse();
-
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SetIconResponse);
-};
-
-} // namespace commands
-} // namespace application_manager
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
index 40debbcd4d..aeb53a115e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
@@ -161,8 +161,16 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
(*on_btn_event)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonEventID);
- (*on_btn_event)[strings::msg_params][strings::button_name] =
- (*message_)[strings::msg_params][hmi_response::button_name];
+ mobile_apis::ButtonName::eType btn_id =
+ static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
+ app->msg_version() <= utils::version_4_5) {
+ btn_id = mobile_apis::ButtonName::OK;
+ }
+
+ (*on_btn_event)[strings::msg_params][strings::button_name] = btn_id;
(*on_btn_event)[strings::msg_params][strings::button_event_mode] =
(*message_)[strings::msg_params][hmi_response::button_mode];
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
index faf6ffe38b..56a87da305 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
@@ -35,6 +35,7 @@
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
+#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -168,8 +169,16 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
(*on_btn_press)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonPressID);
- (*on_btn_press)[strings::msg_params][strings::button_name] =
- (*message_)[strings::msg_params][hmi_response::button_name];
+ mobile_apis::ButtonName::eType btn_id =
+ static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
+ app->msg_version() <= utils::version_4_5) {
+ btn_id = mobile_apis::ButtonName::OK;
+ }
+
+ (*on_btn_press)[strings::msg_params][strings::button_name] = btn_id;
(*on_btn_press)[strings::msg_params][strings::button_press_mode] =
(*message_)[strings::msg_params][hmi_response::button_mode];
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 70307b8da2..9cfd4f33b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -332,9 +332,14 @@ void RegisterAppInterfaceRequest::Run() {
}
// Version negotiation
+ utils::SemanticVersion ver_4_5(4, 5, 0);
utils::SemanticVersion module_version(
major_version, minor_version, patch_version);
- if (mobile_version < module_version) {
+ if (mobile_version <= ver_4_5) {
+ // Mobile versioning did not exist for
+ // versions 4.5 and prior.
+ application->set_msg_version(ver_4_5);
+ } else if (mobile_version < module_version) {
// Use mobile RPC version as negotiated version
application->set_msg_version(mobile_version);
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
index 73b38823d8..31eb738357 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
@@ -60,6 +60,40 @@ void RegisterAppInterfaceResponse::Run() {
}
}
+ application_manager::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (app && app->msg_version() <= utils::version_4_5 &&
+ app->is_media_application() &&
+ (*message_)[strings::msg_params].keyExists(
+ hmi_response::button_capabilities)) {
+ const smart_objects::SmartObject& button_caps =
+ (*message_)[strings::msg_params][hmi_response::button_capabilities];
+ auto it = button_caps.asArray()->begin();
+ auto ok_btn_it = it;
+ bool ok_btn_exists = false;
+ bool play_pause_btn_exists = false;
+ for (; it != button_caps.asArray()->end(); ++it) {
+ smart_objects::SmartObject& so = *it;
+ int64_t current_id = so[strings::name].asInt();
+ if (current_id == -1) {
+ continue;
+ }
+ const mobile_apis::ButtonName::eType current_button =
+ static_cast<mobile_apis::ButtonName::eType>(current_id);
+ if (current_button == mobile_apis::ButtonName::PLAY_PAUSE) {
+ play_pause_btn_exists = true;
+ so[strings::name] = mobile_apis::ButtonName::OK;
+ } else if (current_button == mobile_apis::ButtonName::OK) {
+ ok_btn_exists = true;
+ ok_btn_it = it;
+ }
+ }
+ if (ok_btn_exists && play_pause_btn_exists) {
+ button_caps.asArray()->erase(ok_btn_it);
+ }
+ }
+
SendResponse(success, result_code, last_message);
if (mobile_apis::Result::SUCCESS != result_code) {
@@ -68,16 +102,14 @@ void RegisterAppInterfaceResponse::Run() {
// Add registered application to the policy db right after response sent to
// mobile to be able to check all other API according to app permissions
- application_manager::ApplicationSharedPtr application =
- application_manager_.application(connection_key());
- if (!application) {
+ if (!app) {
LOG4CXX_ERROR(logger_,
"Application with connection key " << connection_key()
<< " is not registered.");
return;
}
- SetHeartBeatTimeout(connection_key(), application->policy_app_id());
+ SetHeartBeatTimeout(connection_key(), app->policy_app_id());
}
void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc
deleted file mode 100644
index 54c202f7b0..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-
- Copyright (c) 2018, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "sdl_rpc_plugin/commands/mobile/set_icon_request.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/application_impl.h"
-#include "config_profile/profile.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
-#include "utils/file_system.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SetIconRequest::SetIconRequest(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
-
-SetIconRequest::~SetIconRequest() {}
-
-void SetIconRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- ApplicationSharedPtr app = application_manager_.application(connection_key());
-
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return;
- }
-
- const std::string& sync_file_name =
- (*message_)[strings::msg_params][strings::sync_file_name].asString();
-
- std::string full_file_path =
- application_manager_.get_settings().app_storage_folder() + "/";
- full_file_path += app->folder_name();
- full_file_path += "/";
- full_file_path += sync_file_name;
-
- if (!file_system::FileExists(full_file_path)) {
- LOG4CXX_ERROR(logger_, "No such file " << full_file_path);
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
-
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- msg_params[strings::app_id] = app->app_id();
- msg_params[strings::sync_file_name] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- // Panasonic requres unchanged path value without encoded special characters
- const std::string full_file_path_for_hmi =
- file_system::ConvertPathForURL(full_file_path);
-
- msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi;
-
- // TODO(VS): research why is image_type hardcoded
- msg_params[strings::sync_file_name][strings::image_type] =
- static_cast<int32_t>(SetIconRequest::ImageType::DYNAMIC);
-
- // for further use in on_event function
- (*message_)[strings::msg_params][strings::sync_file_name] =
- msg_params[strings::sync_file_name];
- StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true);
-}
-
-void SetIconRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& message = event.smart_object();
-
- switch (event.id()) {
- case hmi_apis::FunctionID::UI_SetAppIcon: {
- EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
- bool result = mobile_apis::Result::SUCCESS == result_code;
-
- if (result) {
- ApplicationSharedPtr app =
- application_manager_.application(connection_key());
-
- const std::string path =
- (*message_)[strings::msg_params][strings::sync_file_name]
- [strings::value].asString();
- app->set_app_icon_path(path);
-
- LOG4CXX_INFO(logger_,
- "Icon path was set to '" << app->app_icon_path() << "'");
- }
-
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
- return;
- }
- }
-}
-
-} // namespace commands
-
-} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc
deleted file mode 100644
index 514c6ad6d4..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-
- Copyright (c) 2018, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "sdl_rpc_plugin/commands/mobile/set_icon_response.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SetIconResponse::SetIconResponse(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& app_man,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : CommandResponseImpl(
- message, app_man, rpc_service, hmi_capabilities, policy_handler) {}
-
-SetIconResponse::~SetIconResponse() {}
-
-void SetIconResponse::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- rpc_service_.SendMessageToMobile(message_);
-}
-
-} // namespace commands
-
-} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 908a251962..85cb26321b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/subscribe_button_request.h"
+#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -65,7 +66,7 @@ void SubscribeButtonRequest::Run() {
return;
}
- const mobile_apis::ButtonName::eType btn_id =
+ mobile_apis::ButtonName::eType btn_id =
static_cast<mobile_apis::ButtonName::eType>(
(*message_)[str::msg_params][str::button_name].asInt());
@@ -76,7 +77,20 @@ void SubscribeButtonRequest::Run() {
return;
}
- if (!CheckHMICapabilities(btn_id)) {
+ if (app->msg_version() <= utils::version_4_5 &&
+ btn_id == mobile_apis::ButtonName::OK && app->is_media_application()) {
+ bool ok_supported = CheckHMICapabilities(mobile_apis::ButtonName::OK);
+ bool play_pause_supported =
+ CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE);
+ if (play_pause_supported) {
+ LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE");
+ btn_id = mobile_apis::ButtonName::PLAY_PAUSE;
+ (*message_)[str::msg_params][str::button_name] = btn_id;
+ } else if (!ok_supported) {
+ LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities");
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ }
+ } else if (!CheckHMICapabilities(btn_id)) {
LOG4CXX_ERROR(logger_,
"Subscribe on button "
<< btn_id << " isn't allowed by HMI capabilities");
@@ -105,7 +119,8 @@ bool SubscribeButtonRequest::Init() {
bool SubscribeButtonRequest::IsSubscriptionAllowed(
ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) {
if (!app->is_media_application() &&
- ((mobile_apis::ButtonName::SEEKLEFT == btn_id) ||
+ ((mobile_apis::ButtonName::PLAY_PAUSE == btn_id) ||
+ (mobile_apis::ButtonName::SEEKLEFT == btn_id) ||
(mobile_apis::ButtonName::SEEKRIGHT == btn_id) ||
(mobile_apis::ButtonName::TUNEUP == btn_id) ||
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
index 6537f0e7b2..ccfaef54cb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
@@ -34,6 +34,7 @@
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h"
#include "application_manager/application_impl.h"
+#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -67,11 +68,24 @@ void UnsubscribeButtonRequest::Run() {
return;
}
- const mobile_apis::ButtonName::eType btn_id =
+ mobile_apis::ButtonName::eType btn_id =
static_cast<mobile_apis::ButtonName::eType>(
(*message_)[str::msg_params][str::button_name].asInt());
- if (!CheckHMICapabilities(btn_id)) {
+ if (app->msg_version() <= utils::version_4_5 &&
+ btn_id == mobile_apis::ButtonName::OK && app->is_media_application()) {
+ bool ok_supported = CheckHMICapabilities(mobile_apis::ButtonName::OK);
+ bool play_pause_supported =
+ CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE);
+ if (play_pause_supported) {
+ LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE");
+ btn_id = mobile_apis::ButtonName::PLAY_PAUSE;
+ (*message_)[str::msg_params][str::button_name] = btn_id;
+ } else if (!ok_supported) {
+ LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities");
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ }
+ } else if (!CheckHMICapabilities(btn_id)) {
LOG4CXX_ERROR(logger_,
"Button " << btn_id << " isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
index 0f02deded0..2303948355 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -223,7 +223,6 @@
#include "hmi/on_tts_reset_timeout_notification.h"
#include "hmi/dial_number_request.h"
#include "hmi/dial_number_response.h"
-#include "hmi/ui_set_icon_request.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
index 9fa864d30d..eabf5ed7cc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
@@ -103,7 +103,6 @@
#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h"
#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index bbc18504a6..0196b59b79 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -73,6 +73,8 @@ class SubscribeButtonRequestTest
};
typedef SubscribeButtonRequestTest::MockHMICapabilities MockHMICapabilities;
+const utils::SemanticVersion mock_semantic_version(5, 0, 0);
+const utils::SemanticVersion mock_semantic_version_4_5(4, 5, 0);
TEST_F(SubscribeButtonRequestTest, Run_AppNotRegistered_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
@@ -110,6 +112,9 @@ TEST_F(SubscribeButtonRequestTest, Run_UiIsNotSupported_UNSUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_media_application()).WillByDefault(Return(false));
+
ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
.WillByDefault(Return(false));
@@ -130,6 +135,7 @@ TEST_F(SubscribeButtonRequestTest, Run_IsSubscribedToButton_UNSUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
ON_CALL(*app, is_media_application()).WillByDefault(Return(true));
ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
@@ -160,6 +166,7 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
ON_CALL(*app, is_media_application()).WillByDefault(Return(true));
ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
@@ -195,6 +202,60 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
[am::strings::result_code].asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Version_4_5) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::OK;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version_4_5));
+ ON_CALL(*app, is_media_application()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+ (*button_caps_ptr)[1][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::PLAY_PAUSE;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(hmi_apis::Common_ButtonName::PLAY_PAUSE,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::name]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code].asInt()));
+}
+
} // namespace subscribe_button_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
index e363567c64..d6bef42794 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
@@ -28,6 +28,8 @@ typedef std::shared_ptr<UnsubscribeButtonRequest> CommandPtr;
namespace {
const uint32_t kConnectionKey = 1u;
const mobile_apis::ButtonName::eType kButtonId = mobile_apis::ButtonName::OK;
+const utils::SemanticVersion mock_semantic_version(5, 0, 0);
+const utils::SemanticVersion mock_semantic_version_4_5(4, 5, 0);
} // namespace
class UnsubscribeButtonRequestTest
@@ -73,6 +75,8 @@ TEST_F(UnsubscribeButtonRequestTest,
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
.WillOnce(Return(false));
@@ -94,6 +98,8 @@ TEST_F(UnsubscribeButtonRequestTest,
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
EXPECT_CALL(mock_hmi_capabilities_, is_ui_cooperating())
.WillOnce(Return(true));
@@ -128,6 +134,8 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
.WillOnce(Return(true));
@@ -143,6 +151,49 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
command->Run();
}
+TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Version_4_5) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::OK;
+
+ CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillRepeatedly(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::OK;
+ (*button_caps_ptr)[1][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::PLAY_PAUSE;
+
+ EXPECT_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillRepeatedly(Return(button_caps_ptr.get()));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version_4_5));
+ ON_CALL(*mock_app, is_media_application()).WillByDefault(Return(true));
+
+ EXPECT_CALL(*mock_app,
+ UnsubscribeFromButton(mobile_apis::ButtonName::PLAY_PAUSE))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::Buttons_OnButtonSubscription)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ EXPECT_CALL(*mock_app, UpdateHash());
+ command->Init();
+ command->Run();
+}
+
} // namespace unsubscribe_button_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index d00fc2ae19..806feac58a 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -99,6 +99,8 @@ void InitCapabilities() {
button_enum_name.insert(
std::make_pair(std::string("OK"), hmi_apis::Common_ButtonName::OK));
button_enum_name.insert(std::make_pair(
+ std::string("PLAY_PAUSE"), hmi_apis::Common_ButtonName::PLAY_PAUSE));
+ button_enum_name.insert(std::make_pair(
std::string("SEEKLEFT"), hmi_apis::Common_ButtonName::SEEKLEFT));
button_enum_name.insert(std::make_pair(
std::string("SEEKRIGHT"), hmi_apis::Common_ButtonName::SEEKRIGHT));
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index a605795b6e..54f85c6c0a 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -219,7 +219,8 @@ void RPCHandlerImpl::GetMessageVersion(
}
utils::SemanticVersion temp_version(major, minor, patch);
if (temp_version.isValid()) {
- message_version = temp_version;
+ utils::SemanticVersion ver_4_5(4, 5, 0);
+ message_version = (temp_version > ver_4_5) ? temp_version : ver_4_5;
}
}
}
@@ -251,10 +252,7 @@ bool RPCHandlerImpl::ConvertMessageToSO(
// Attach RPC version to SmartObject if it does not exist yet.
auto app_ptr = app_manager_.application(message.connection_key());
utils::SemanticVersion msg_version(0, 0, 0);
- if (app_ptr &&
- (output[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS]
- .keyExists(NsSmartDeviceLink::NsJSONHandler::strings::
- S_RPC_MSG_VERSION) == false)) {
+ if (app_ptr) {
msg_version = app_ptr->msg_version();
} else if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
static_cast<mobile_apis::FunctionID::eType>(
diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json
index 1c024f2669..ca67d81d8c 100644
--- a/src/components/application_manager/test/hmi_capabilities.json
+++ b/src/components/application_manager/test/hmi_capabilities.json
@@ -684,6 +684,12 @@
"upDownAvailable": true
},
{
+ "name": "PLAY_PAUSE",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ },
+ {
"name": "SEEKLEFT",
"shortPressAvailable": true,
"longPressAvailable": true,
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index 8d11a0cc93..ae95fca35f 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -255,7 +255,7 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
// Count of buttons in json file
const uint32_t btn_length = buttons_capabilities_so.length();
- EXPECT_EQ(15u, btn_length);
+ EXPECT_EQ(16u, btn_length);
for (uint32_t i = 0; i < btn_length; ++i) {
EXPECT_TRUE((buttons_capabilities_so[i]).keyExists(strings::name));
EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("shortPressAvailable"));
diff --git a/src/components/include/utils/date_time.h b/src/components/include/utils/date_time.h
index 3e649cfc28..17b4fafe38 100644
--- a/src/components/include/utils/date_time.h
+++ b/src/components/include/utils/date_time.h
@@ -33,7 +33,7 @@
#define SRC_COMPONENTS_INCLUDE_UTILS_DATE_TIME_H_
#include <stdint.h>
-#include "boost/date_time.hpp"
+#include "boost/date_time/posix_time/posix_time_duration.hpp"
namespace date_time {
diff --git a/src/components/include/utils/semantic_version.h b/src/components/include/utils/semantic_version.h
index 7b9ec0eb96..244ae82177 100644
--- a/src/components/include/utils/semantic_version.h
+++ b/src/components/include/utils/semantic_version.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SEMANTIC_VERSION_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_SEMANTIC_VERSION_H_
+#include <string>
namespace utils {
struct SemanticVersion {
@@ -116,6 +117,8 @@ struct SemanticVersion {
uint16_t minor_version_ = 0;
uint16_t patch_version_ = 0;
};
+
+extern const SemanticVersion version_4_5;
}
#endif // SRC_COMPONENTS_INCLUDE_UTILS_CALLABLE_H \ No newline at end of file
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index a9854ef730..ec2da366e6 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -80,6 +80,7 @@
<enum name="ButtonName">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
<element name="OK"/>
+ <element name="PLAY_PAUSE"/>
<element name="SEEKLEFT"/>
<element name="SEEKRIGHT"/>
<element name="TUNEUP"/>
@@ -2244,6 +2245,27 @@
<element name="HAZARD_LIGHTS" value="511">
<description>Include all hazard lights: front_left, front_right, rear_left and rear_right.</description>
</element>
+ <element name="REAR_CARGO_LIGHTS" value="512">
+ <description>Cargo lamps illuminate the cargo area.</description>
+ </element>
+ <element name="REAR_TRUCK_BED_LIGHTS" value="513">
+ <description>Truck bed lamps light up the bed of the truck.</description>
+ </element>
+ <element name="REAR_TRAILER_LIGHTS" value="514">
+ <description>Trailer lights are lamps mounted on a trailer hitch.</description>
+ </element>
+ <element name="LEFT_SPOT_LIGHTS" value="515">
+ <description>It is the spotlights mounted on the left side of a vehicle.</description>
+ </element>
+ <element name="RIGHT_SPOT_LIGHTS" value="516">
+ <description>It is the spotlights mounted on the right side of a vehicle.</description>
+ </element>
+ <element name="LEFT_PUDDLE_LIGHTS" value="517">
+ <description>Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.</description>
+ </element>
+ <element name="RIGHT_PUDDLE_LIGHTS" value="518">
+ <description>Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.</description>
+ </element>
<!-- Interior Lights by common function groups 801~900 -->
<element name="AMBIENT_LIGHTS" value="801"/>
@@ -2264,16 +2286,27 @@
<element name="EXTERIOR_RIGHT_LIGHTS" value="904">
<description>Include exterior lights located at the right side of the vehicle. For example, right puddle lights and spot lights.</description>
</element>
+ <element name="EXTERIOR_ALL_LIGHTS" value="905">
+ <description> Include all exterior lights around the vehicle.</description>
+ </element>
</enum>
<enum name="LightStatus">
<element name="ON"/>
<element name="OFF"/>
+ <element name="RAMP_UP"/>
+ <element name="RAMP_DOWN"/>
+ <element name="UNKNOWN"/>
+ <element name="INVALID"/>
</enum>
<struct name="LightCapabilities">
<param name="name" type="LightName" mandatory="true" />
- <!-- Assuming light ON/OFF status is always available -->
+ <param name="statusAvailable" type="Boolean" mandatory="false">
+ <description>
+ Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
+ </description>
+ </param>
<param name="densityAvailable" type="Boolean" mandatory="false">
<description>
Indicates if the light's density can be set remotely (similar to a dimmer).
diff --git a/src/components/interfaces/Json_HMI_message_specification.txt b/src/components/interfaces/Json_HMI_message_specification.txt
index 9f5b20a3c4..f464f42351 100644
--- a/src/components/interfaces/Json_HMI_message_specification.txt
+++ b/src/components/interfaces/Json_HMI_message_specification.txt
@@ -267,6 +267,13 @@ Notifications:
{
"longPressAvailable" : true,
+ "name" : "PLAY_PAUSE",
+ "shortPressAvailable" : true,
+ "upDownAvailable" : true
+ },
+
+ {
+ "longPressAvailable" : true,
"name" : "SEEKLEFT",
"shortPressAvailable" : true,
"upDownAvailable" : true
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index f2c05d99be..c36c4a4533 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -562,6 +562,16 @@
<enum name="ButtonName" since="1.0">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
<element name="OK" />
+ <element name="PLAY_PAUSE" since="5.0">
+ <description>
+ The button name for the physical Play/Pause
+ toggle that can be used by media apps.
+ </description>
+ <warning>
+ Please use the physical OK button in order to
+ use a Play/Pause toggle for versions &lt; 4.5.0.
+ </warning>
+ </element>
<element name="SEEKLEFT" />
<element name="SEEKRIGHT" />
<element name="TUNEUP" />
@@ -3396,6 +3406,27 @@
<element name="HAZARD_LIGHTS" value="511">
<description>Include all hazard lights: front_left, front_right, rear_left and rear_right.</description>
</element>
+ <element name="REAR_CARGO_LIGHTS" value="512">
+ <description>Cargo lamps illuminate the cargo area.</description>
+ </element>
+ <element name="REAR_TRUCK_BED_LIGHTS" value="513">
+ <description>Truck bed lamps light up the bed of the truck.</description>
+ </element>
+ <element name="REAR_TRAILER_LIGHTS" value="514">
+ <description>Trailer lights are lamps mounted on a trailer hitch.</description>
+ </element>
+ <element name="LEFT_SPOT_LIGHTS" value="515">
+ <description>It is the spotlights mounted on the left side of a vehicle.</description>
+ </element>
+ <element name="RIGHT_SPOT_LIGHTS" value="516">
+ <description>It is the spotlights mounted on the right side of a vehicle.</description>
+ </element>
+ <element name="LEFT_PUDDLE_LIGHTS" value="517">
+ <description>Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.</description>
+ </element>
+ <element name="RIGHT_PUDDLE_LIGHTS" value="518">
+ <description>Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.</description>
+ </element>
<!-- Interior Lights by common function groups 801~900 -->
<element name="AMBIENT_LIGHTS" value="801"/>
@@ -3416,16 +3447,27 @@
<element name="EXTERIOR_RIGHT_LIGHTS" value="904">
<description>Include exterior lights located at the right side of the vehicle. For example, right puddle lights and spot lights.</description>
</element>
+ <element name="EXTERIOR_ALL_LIGHTS" value="905">
+ <description> Include all exterior lights around the vehicle.</description>
+ </element>
</enum>
<enum name="LightStatus" since="5.0">
<element name="ON"/>
<element name="OFF"/>
+ <element name="RAMP_UP"/>
+ <element name="RAMP_DOWN"/>
+ <element name="UNKNOWN"/>
+ <element name="INVALID"/>
</enum>
<struct name="LightCapabilities" since="5.0">
<param name="name" type="LightName" mandatory="true" />
- <!-- Assuming light ON/OFF status is always available -->
+ <param name="statusAvailable" type="Boolean" mandatory="false">
+ <description>
+ Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
+ </description>
+ </param>
<param name="densityAvailable" type="Boolean" mandatory="false">
<description>
Indicates if the light's density can be set remotely (similar to a dimmer).
diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/log_message_loop_thread.h
index d6a9edd072..b20b43c251 100644
--- a/src/components/utils/include/utils/log_message_loop_thread.h
+++ b/src/components/utils/include/utils/log_message_loop_thread.h
@@ -56,18 +56,14 @@ typedef std::queue<LogMessage> LogMessageQueue;
typedef threads::MessageLoopThread<LogMessageQueue>
LogMessageLoopThreadTemplate;
-class LogMessageHandler : public LogMessageLoopThreadTemplate::Handler {
- public:
- virtual void Handle(const LogMessage message) OVERRIDE;
-};
-
-class LogMessageLoopThread : public LogMessageLoopThreadTemplate {
+class LogMessageLoopThread : public LogMessageLoopThreadTemplate,
+ public LogMessageLoopThreadTemplate::Handler {
public:
LogMessageLoopThread();
~LogMessageLoopThread();
+ void Handle(const LogMessage message) OVERRIDE;
private:
- LogMessageHandler* handler_;
DISALLOW_COPY_AND_ASSIGN(LogMessageLoopThread);
};
diff --git a/src/components/utils/src/date_time.cc b/src/components/utils/src/date_time.cc
index 2802ed0f91..fa645f4ecf 100644
--- a/src/components/utils/src/date_time.cc
+++ b/src/components/utils/src/date_time.cc
@@ -30,14 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/date_time.h"
+
#include <stdint.h>
#include <sys/time.h>
-#include "utils/date_time.h"
+#include "boost/date_time/posix_time/posix_time.hpp"
namespace bpt = boost::posix_time;
using namespace boost::date_time;
namespace date_time {
-
/* Set of helper functions for the TimeDuration struct
*/
diff --git a/src/components/utils/src/log_message_loop_thread.cc b/src/components/utils/src/log_message_loop_thread.cc
index 2b7f28fbfd..182eb64534 100644
--- a/src/components/utils/src/log_message_loop_thread.cc
+++ b/src/components/utils/src/log_message_loop_thread.cc
@@ -35,7 +35,7 @@
namespace logger {
-void LogMessageHandler::Handle(const LogMessage message) {
+void LogMessageLoopThread::Handle(const LogMessage message) {
message.logger->forcedLog(message.level,
message.entry,
message.timeStamp,
@@ -44,14 +44,13 @@ void LogMessageHandler::Handle(const LogMessage message) {
}
LogMessageLoopThread::LogMessageLoopThread()
- : LogMessageLoopThreadTemplate("Logger",
- handler_ = new LogMessageHandler()) {}
+ : LogMessageLoopThreadTemplate("Logger", this) {}
LogMessageLoopThread::~LogMessageLoopThread() {
// we'll have to drop messages
// while deleting logger thread
logger_status = DeletingLoggerThread;
- delete handler_;
+ LogMessageLoopThreadTemplate::Shutdown();
}
} // namespace logger
diff --git a/src/components/utils/src/logger.cc b/src/components/utils/src/logger.cc
index 4e93ca3d14..af21aeac77 100644
--- a/src/components/utils/src/logger.cc
+++ b/src/components/utils/src/logger.cc
@@ -39,6 +39,9 @@ void deinit_logger() {
CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
LOG4CXX_DEBUG(logger_, "Logger deinitialization");
logger::set_logs_enabled(false);
+ if (logger::logger_status == logger::LoggerThreadCreated) {
+ logger::flush_logger();
+ }
logger::delete_log_message_loop_thread();
log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger();
log4cxx::spi::LoggerRepositoryPtr repository =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_icon_request.cc b/src/components/utils/src/semantic_version.cc
index 44049338a8..4b8d37b913 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_icon_request.cc
+++ b/src/components/utils/src/semantic_version.cc
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018, Ford Motor Company
+/*
+ * Copyright (c) 2018, Livio
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,34 +29,10 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/semantic_version.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h"
+namespace utils {
-namespace sdl_rpc_plugin {
-using namespace application_manager;
+const SemanticVersion version_4_5(4, 5, 0);
-namespace commands {
-
-UISetIconRequest::UISetIconRequest(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-UISetIconRequest::~UISetIconRequest() {}
-
-void UISetIconRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- SendRequest();
-}
-
-} // namespace commands
-
-} // namespace application_manager
+} // namespace utils \ No newline at end of file
diff --git a/src/components/utils/test/log_message_loop_thread_test.cc b/src/components/utils/test/log_message_loop_thread_test.cc
index 032c7ecae1..92287fb45b 100644
--- a/src/components/utils/test/log_message_loop_thread_test.cc
+++ b/src/components/utils/test/log_message_loop_thread_test.cc
@@ -57,7 +57,7 @@ TEST(LogMessageLoopThread, DestroyLogMessage_loggerStatusDeletingLogger) {
logger::logger_status = LoggerThreadNotCreated;
}
-class MockLogMessageTest : public LogMessageHandler {
+class MockLogMessageTest : public LogMessageLoopThread {
public:
MOCK_CONST_METHOD1(Handle, void(const LogMessage message));
};
diff --git a/tools/intergen/test/test_hmi_interface.xml b/tools/intergen/test/test_hmi_interface.xml
index c8d0a789e0..7573d35ef9 100644
--- a/tools/intergen/test/test_hmi_interface.xml
+++ b/tools/intergen/test/test_hmi_interface.xml
@@ -66,6 +66,7 @@
<enum name="ButtonName">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
<element name="OK"/>
+ <element name="PLAY_PAUSE"/>
<element name="SEEKLEFT"/>
<element name="SEEKRIGHT"/>
<element name="TUNEUP"/>