summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Byzhynar <AByzhynar@luxoft.com>2017-09-29 15:22:18 +0300
committerBSolonenko <BSolonenko@luxoft.com>2018-01-26 13:58:48 +0200
commit317031df8dff188682ff8b99e493368a31afd179 (patch)
tree4fb00a2705863984af67a53cd4ab0999ce75f1e4
parentebee0a99fc42792d79163f71a8d76ca7b75e0b89 (diff)
downloadsdl_core-317031df8dff188682ff8b99e493368a31afd179.tar.gz
Fix SDL behavior in case of param disallowed by policies and double
subscription - Fixed response to mobile when app tries to subscribe to already subscribed param - Fixed response to mobile when request contains parameter disallowed by policies - Added some logging - Fixed mistake in function name
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h2
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc1
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc23
3 files changed, 16 insertions, 10 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
index f556f81764..5676f14617 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
@@ -130,7 +130,7 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl {
* HMI
* @param result contains result that SDL sends to mobile app.
*/
- void CheckVISubscribtions(ApplicationSharedPtr app,
+ void CheckVISubscriptions(ApplicationSharedPtr app,
std::string& out_info,
mobile_apis::Result::eType& out_result_code,
smart_objects::SmartObject& out_response_params,
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 09aa4169e5..5125c34ef5 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -793,6 +793,7 @@ void CommandRequestImpl::AddDisallowedParameters(
}
bool CommandRequestImpl::HasDisallowedParams() const {
+ LOG4CXX_AUTO_TRACE(logger_);
return ((!removed_parameters_permissions_.disallowed_params.empty()) ||
(!removed_parameters_permissions_.undefined_params.empty()));
}
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
index 28cf4c754c..4e31a2abe2 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -116,7 +116,7 @@ void SubscribeVehicleDataRequest::Run() {
smart_objects::SmartObject response_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
bool result = false;
- CheckVISubscribtions(
+ CheckVISubscriptions(
app, info, result_code, response_params, msg_params, result);
if (mobile_apis::Result::INVALID_ENUM != result_code) {
@@ -358,16 +358,17 @@ bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
return it != accessor.GetData().end();
}
-void SubscribeVehicleDataRequest::CheckVISubscribtions(
+void SubscribeVehicleDataRequest::CheckVISubscriptions(
ApplicationSharedPtr app,
std::string& out_info,
mobile_apis::Result::eType& out_result_code,
smart_objects::SmartObject& out_response_params,
smart_objects::SmartObject& out_request_params,
bool& out_result) {
- // counter for items to subscribe
+ LOG4CXX_AUTO_TRACE(logger_);
+ // Counter for items to subscribe
VehicleInfoSubscriptions::size_type items_to_subscribe = 0;
- // counter for subscribed items by application
+ // Counter for subscribed items by application
uint32_t subscribed_items = 0;
const VehicleData& vehicle_data = MessageHelper::vehicle_data();
@@ -456,22 +457,26 @@ void SubscribeVehicleDataRequest::CheckVISubscribtions(
out_info = "No data in the request";
}
out_result = false;
+ return;
}
if (0 == subscribed_items && !is_interface_not_available) {
out_result_code = mobile_apis::Result::IGNORED;
out_info = "Already subscribed on provided VehicleData.";
out_result = false;
+ return;
}
if (is_everything_already_subscribed) {
- out_result_code = vi_already_subscribed_by_this_app_.size()
- ? mobile_apis::Result::IGNORED
- : mobile_apis::Result::SUCCESS;
- if (!(vi_already_subscribed_by_this_app_.empty())) {
+ if (vi_already_subscribed_by_this_app_.empty()) {
+ out_result_code = mobile_apis::Result::SUCCESS;
+ out_result = true;
+ } else {
+ out_result_code = mobile_apis::Result::IGNORED;
out_info = "Already subscribed on some provided VehicleData.";
+ out_result = false;
}
- out_result = true;
+ return;
}
}