summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-11-19 14:05:45 -0500
committerGitHub <noreply@github.com>2018-11-19 14:05:45 -0500
commit1fc8ccf55a1e710e45a158091203a3128ae5a97f (patch)
treee9de37ebddd8f2f06469aa01ab955096350a13e6
parent4ea9463583409cc6613f2f6143f47aa28ec2e866 (diff)
parent35c341bb1de8063ce0444513e2bcf14feeeb013c (diff)
downloadsdl_core-1fc8ccf55a1e710e45a158091203a3128ae5a97f.tar.gz
Merge pull request #2734 from AByzhynar/fix/SDL_doesnt_include_binary_data_to_OnSystemRequest_RT_OEM_SPECIFIC
Add binary data to OEM_SPECIFIC request type in OnSystemRequest notification
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index b78e541f17..10b0b41a58 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -36,6 +36,7 @@
#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h"
#include "interfaces/MOBILE_API.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
#include "policy/policy_table/enums.h"
#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler_interface.h"
@@ -65,6 +66,7 @@ void OnSystemRequestNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace application_manager;
using namespace mobile_apis;
+ using namespace helpers;
ApplicationSharedPtr app = application_manager_.application(connection_key());
@@ -106,17 +108,33 @@ void OnSystemRequestNotification::Run() {
}
}
- if (mobile_apis::RequestType::PROPRIETARY == request_type) {
- /* According to requirements:
- "If the requestType = PROPRIETARY, add to mobile API fileType = JSON
- If the requestType = HTTP, add to mobile API fileType = BINARY"
- Also in Genivi SDL we don't save the PT to file - we put it directly in
- binary_data */
+ LOG4CXX_DEBUG(logger_,
+ "Processing Request type : " << stringified_request_type);
+
+ const bool binary_data_is_required =
+ Compare<mobile_apis::RequestType::eType, EQ, ONE>(
+ request_type,
+ mobile_apis::RequestType::PROPRIETARY,
+ mobile_apis::RequestType::OEM_SPECIFIC);
+ BinaryMessage binary_data;
+ if (binary_data_is_required) {
const std::string filename =
(*message_)[strings::msg_params][strings::file_name].asString();
- BinaryMessage binary_data;
file_system::ReadBinaryFile(filename, binary_data);
+ }
+
+ if (mobile_apis::RequestType::OEM_SPECIFIC == request_type) {
+ (*message_)[strings::params][strings::binary_data] = binary_data;
+ }
+
+ if (mobile_apis::RequestType::PROPRIETARY == request_type) {
+/* According to requirements:
+ "If the requestType = PROPRIETARY, add to mobile API fileType = JSON
+ If the requestType = HTTP, add to mobile API fileType = BINARY"
+ Also in Genivi SDL we don't save the PT to file - we put it directly in
+ binary_data */
+
#if defined(PROPRIETARY_MODE)
AddHeader(binary_data);
#endif // PROPRIETARY_MODE
@@ -126,7 +144,9 @@ void OnSystemRequestNotification::Run() {
#endif // PROPRIETARY_MODE
(*message_)[strings::msg_params][strings::file_type] = FileType::JSON;
- } else if (mobile_apis::RequestType::HTTP == request_type) {
+ }
+
+ if (mobile_apis::RequestType::HTTP == request_type) {
(*message_)[strings::msg_params][strings::file_type] = FileType::BINARY;
if ((*message_)[strings::msg_params].keyExists(strings::url)) {
(*message_)[strings::msg_params][strings::timeout] =