summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhdanovP <pzhdanov@luxoft.com>2018-08-27 11:11:29 +0300
committerZhdanovP <pzhdanov@luxoft.com>2018-09-05 10:22:12 +0300
commit449f0cd693cc10ed71393c37c1b76cb3a29048f4 (patch)
tree8741346a30f1bf8290bbd23d51b9d659d176dce2
parent95aa2d64a495f250a74fc23efe2cae5ce35c51d2 (diff)
downloadsdl_core-fix/sdl_does_not_check_for_non_mandatory_parameters.tar.gz
Add additional check for non-manadatory parametersfix/sdl_does_not_check_for_non_mandatory_parameters
The OnPutFile notification has non mandatory parameters `fileSize` and `length`. If the mobile application has no provided appropriate parameters SDL sends `fileSize`: null as json value to HMI. The commit fixes the issue and simply remove non mandatory parameter in case mobile app sends nothing for one.
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
index d5a13c99a0..b418f52fa3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
@@ -302,18 +302,16 @@ void PutFileRequest::SendOnPutFileNotification() {
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
-
smart_objects::SmartObject& message = *notification;
message[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_OnPutFile;
-
message[strings::params][strings::message_type] = MessageType::kNotification;
message[strings::msg_params][strings::app_id] = connection_key();
message[strings::msg_params][strings::sync_file_name] = sync_file_name_;
message[strings::msg_params][strings::offset] = offset_;
- if (0 == offset_) {
- message[strings::msg_params][strings::file_size] =
- (*message_)[strings::msg_params][strings::length];
+ if (0 == offset_ &&
+ !(*message_)[strings::msg_params].keyExists(strings::length)) {
+ message[strings::msg_params][strings::file_size] = length_;
}
message[strings::msg_params][strings::length] = length_;
message[strings::msg_params][strings::persistent_file] = is_persistent_file_;