summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan <bsolonenko@luxoft.com>2018-03-01 11:15:30 +0200
committerIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2018-06-26 12:01:46 +0300
commit69a5215a96234aa685525fc999bcf31bc57fef07 (patch)
treea6fae54b3e26861ab05c221a4417232de4040b14
parent4453774c786f847c3a533a73f58439dc8ca64a55 (diff)
downloadsdl_core-69a5215a96234aa685525fc999bcf31bc57fef07.tar.gz
Fix falling atf test script
Resource didn't set state 'FREE' in set_interior_vehicle_data_request.cc module_data was passed by value and not by reference. The logic CutOffReadOnlyParams has changed. Fix module type extraction from hmi response
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc31
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc4
3 files changed, 21 insertions, 17 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
index edf6ca9d55..d42e8e9d1f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
@@ -149,12 +149,11 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
"conditional mandatory parameter "
<< message_params::kIsSubscribed
<< " missed in hmi response");
-
const char* module_type;
NsSmartDeviceLink::NsSmartObjects::
EnumConversionHelper<mobile_apis::ModuleType::eType>::EnumToCString(
static_cast<mobile_apis::ModuleType::eType>(
- hmi_response[app_mngr::strings::msg_params]
+ hmi_response[app_mngr::strings::msg_params][message_params::kModuleData]
[message_params::kModuleType].asUInt()),
&module_type);
is_subscribed = extension->IsSubscibedToInteriorVehicleData(module_type);
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 deff3b786c..9fcce2f7d6 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
@@ -142,7 +142,7 @@ bool CheckIfModuleDataExistInCapabilities(
void SetInteriorVehicleDataRequest::Execute() {
LOG4CXX_AUTO_TRACE(logger_);
- auto module_data =
+ smart_objects::SmartObject& module_data =
(*message_)[app_mngr::strings::msg_params][message_params::kModuleData];
const std::string module_type = ModuleType();
bool module_type_and_data_match = true;
@@ -163,6 +163,7 @@ void SetInteriorVehicleDataRequest::Execute() {
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");
@@ -170,6 +171,7 @@ void SetInteriorVehicleDataRequest::Execute() {
}
if (AreAllParamsReadOnly(module_data)) {
LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!");
+ SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::READ_ONLY,
"All request params in module type are READ ONLY!");
@@ -219,13 +221,14 @@ void SetInteriorVehicleDataRequest::on_event(
mobile_apis::Result::SUCCESS,
mobile_apis::Result::WARNINGS);
- // if (result) {
- // response_params_[message_params::kModuleData] =
- // value[json_keys::kResult][message_params::kModuleData];
- // }
+ smart_objects::SmartObject response_params;
+ if (result) {
+ response_params = hmi_response[app_mngr::strings::msg_params];
+ }
std::string info;
GetInfo(hmi_response, info);
- SendResponse(result, result_code, info.c_str());
+ SendResponse(
+ result, result_code, info.c_str(), result ? &response_params : nullptr);
}
const smart_objects::SmartObject& SetInteriorVehicleDataRequest::ControlData(
@@ -274,19 +277,17 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
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);
- for (; it != module_type_params.map_end(); ++it) {
- if (helpers::in_range(ro_params, it->first)) {
+
+ for (auto& it : ro_params) {
+ if (module_type_params.keyExists(it)) {
if (enums_value::kClimate == module_type) {
- module_data[message_params::kClimateControlData].erase(it->first);
- LOG4CXX_DEBUG(logger_,
- "Cutting-off READ ONLY parameter: " << it->first);
+ 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->first);
- LOG4CXX_DEBUG(logger_,
- "Cutting-off READ ONLY parameter: " << it->first);
+ module_data[message_params::kRadioControlData].erase(it);
+ LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
}
}
}
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index b531f6fa8a..491fc72de4 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -580,6 +580,10 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
mobile_result = mobile_apis::Result::SAVED;
break;
}
+ case hmi_apis::Common_Result::READ_ONLY: {
+ mobile_result = mobile_apis::Result::READ_ONLY;
+ break;
+ }
default: {
LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code);
break;