summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav Mamykin (GitHub) <ymamykin@luxoft.com>2019-10-11 15:30:15 +0300
committerYarik <ymamykin@gmail.com>2019-11-15 15:19:04 +0200
commit37d3b12ea4e87ac0fdf6914ef433a7892ae0cb19 (patch)
tree85b8d019a97a8bc6c28b803f21abae6b21fc63a8
parent3bfff8281000a0d31bc6d96bf4793cbf4a291cb3 (diff)
downloadsdl_core-37d3b12ea4e87ac0fdf6914ef433a7892ae0cb19.tar.gz
fixup! Fix versioning appliance for vehicle data
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc53
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc16
-rw-r--r--src/components/smart_objects/include/smart_objects/object_schema_item.h11
3 files changed, 39 insertions, 41 deletions
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
index 9e76da328f..8a9727131e 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
@@ -290,8 +290,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
bool(*item.deprecated),
bool(*item.removed),
history,
- SMember::Type::CUSTOM); // Mark member as custom as soon as custom data is treated
- // in different way
+ SMember::Type::CUSTOM); // Mark member as custom as soon as custom
+ // data is treated in different way
}
case SMemberType::SMEMBER_VDR_MOBILE: {
// valid since struct_schema_items is not used in
@@ -308,8 +308,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
bool(*item.deprecated),
bool(*item.removed),
history,
- SMember::Type::CUSTOM); // Mark member as custom as soon as custom data is treated
- // in different way
+ SMember::Type::CUSTOM); // Mark member as custom as soon as custom
+ // data is treated in different way
}
case SMemberType::SMEMBER_MOBILE: {
TSchemaItemParameter<VehicleDataItem> tschema_item(item);
@@ -323,8 +323,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
bool(*item.deprecated),
bool(*item.removed),
history,
- SMember::Type::CUSTOM); // Mark member as custom as soon as custom data is treated
- // in different way
+ SMember::Type::CUSTOM); // Mark member as custom as soon as custom
+ // data is treated in different way
}
case SMemberType::SMEMBER_BOOL_HMI: {
auto member_schema =
@@ -345,27 +345,30 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
);
}
case SMemberType::SMEMBER_HMI: {
- std::function<VehicleDataItem(const VehicleDataItem&)> remove_validation_params;
- remove_validation_params = [&remove_validation_params](const VehicleDataItem& vd_item) -> VehicleDataItem {
- VehicleDataItem result;
- result.since = vd_item.since;
- result.until = vd_item.until;
- result.key = vd_item.key;
- result.name = vd_item.name;
- result.type = vd_item.type;
- result.array = vd_item.array;
- result.removed = vd_item.removed;
- result.deprecated = vd_item.deprecated;
- result.mark_initialized();
-
- if (vd_item.params->is_initialized()) {
- for (const auto& param : *vd_item.params) {
- result.params->push_back(remove_validation_params(param));
- }
- result.params->mark_initialized();
+ std::function<VehicleDataItem(const VehicleDataItem&)>
+ remove_validation_params;
+ remove_validation_params =
+ [&remove_validation_params](
+ const VehicleDataItem& vd_item) -> VehicleDataItem {
+ VehicleDataItem result;
+ result.since = vd_item.since;
+ result.until = vd_item.until;
+ result.key = vd_item.key;
+ result.name = vd_item.name;
+ result.type = vd_item.type;
+ result.array = vd_item.array;
+ result.removed = vd_item.removed;
+ result.deprecated = vd_item.deprecated;
+ result.mark_initialized();
+
+ if (vd_item.params->is_initialized()) {
+ for (const auto& param : *vd_item.params) {
+ result.params->push_back(remove_validation_params(param));
}
+ result.params->mark_initialized();
+ }
- return result;
+ return result;
};
auto processed_item = remove_validation_params(item);
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index 2da2f3bb8d..f92e988ccd 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -538,23 +538,24 @@ void RPCServiceImpl::SendMessageToMobile(
mobile_so_factory().attachSchema(*message, false, app->msg_version());
rpc::ValidationReport report("RPC");
auto validation_result = message->validate(&report, app->msg_version());
- LOG4CXX_DEBUG(
- logger_,
- "Attached schema to message, result if valid: " << validation_result << "\nError report: " << rpc::PrettyFormat(report));
+ LOG4CXX_DEBUG(logger_,
+ "Attached schema to message, result if valid: "
+ << validation_result
+ << "\nError report: " << rpc::PrettyFormat(report));
const auto api_function_id = static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asUInt());
if (api_function_id == mobile_apis::FunctionID::GetVehicleDataID) {
if (validation_result != smart_objects::errors::eType::OK) {
- if (mobile_apis::Result::SUCCESS == (*message)[strings::msg_params][strings::result_code].asUInt()) {
+ if (mobile_apis::Result::SUCCESS ==
+ (*message)[strings::msg_params][strings::result_code].asUInt()) {
smart_objects::SmartObjectSPtr response =
MessageHelper::CreateNegativeResponse(
(*message)[strings::params][strings::connection_key].asUInt(),
api_function_id,
(*message)[strings::params][strings::correlation_id].asUInt(),
- static_cast<int32_t>(
- mobile_apis::Result::GENERIC_ERROR));
+ static_cast<int32_t>(mobile_apis::Result::GENERIC_ERROR));
SendMessageToMobile(response);
return;
@@ -568,8 +569,6 @@ void RPCServiceImpl::SendMessageToMobile(
return;
}
- MessageHelper::PrintSmartObject(*message);
-
smart_objects::SmartObject& msg_to_mobile = *message;
// If correlation_id is not present, it is from-HMI message which should be
// checked against policy permissions
@@ -579,7 +578,6 @@ void RPCServiceImpl::SendMessageToMobile(
msg_to_mobile[strings::params][strings::connection_key].asUInt(),
msg_to_mobile[strings::params][strings::function_id].asInt());
} else if (app) {
-
if (validation_result != smart_objects::errors::eType::OK) {
return;
}
diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h
index 7156a6dbc0..59e62d5658 100644
--- a/src/components/smart_objects/include/smart_objects/object_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h
@@ -50,11 +50,10 @@ namespace ns_smart_objects {
* @brief Object member.
**/
struct SMember {
-
- enum class Type {
- CUSTOM = 0,
- API = 1
- };
+ /*
+ * @brief Defines if SMember belongs to Custom Vehicle data or API data
+ */
+ enum class Type { CUSTOM = 0, API = 1 };
/**
* @brief Default constructor.
@@ -83,8 +82,6 @@ struct SMember {
bool CheckHistoryFieldVersion(
const utils::SemanticVersion& MessageVersion) const;
- std::string to_string() const;
-
private:
bool CheckCustomVehicleData(
const utils::SemanticVersion& MessageVersion) const;