summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-08-24 11:28:59 -0400
committerGitHub <noreply@github.com>2018-08-24 11:28:59 -0400
commit632cba9c37dabf827dfaae3ba69ca2dedbaab5e5 (patch)
treeecd5241db179ae50d5c65c4cf1b73e14cacde47c
parent24ff99d123f449f6d8485ccee1696fd672e3cf81 (diff)
parente183f2ad9068cf2b6d9fa1ac661478d89e9e6a1c (diff)
downloadsdl_core-632cba9c37dabf827dfaae3ba69ca2dedbaab5e5.tar.gz
Merge pull request #2519 from JackLivio/fix/update_rpc_version_negotiation_logic
Update mobile version negotiation
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc7
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc8
2 files changed, 9 insertions, 6 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 70307b8da2..9cfd4f33b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -332,9 +332,14 @@ void RegisterAppInterfaceRequest::Run() {
}
// Version negotiation
+ utils::SemanticVersion ver_4_5(4, 5, 0);
utils::SemanticVersion module_version(
major_version, minor_version, patch_version);
- if (mobile_version < module_version) {
+ if (mobile_version <= ver_4_5) {
+ // Mobile versioning did not exist for
+ // versions 4.5 and prior.
+ application->set_msg_version(ver_4_5);
+ } else if (mobile_version < module_version) {
// Use mobile RPC version as negotiated version
application->set_msg_version(mobile_version);
} else {
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 9c2aa497d6..75d2f0d3cb 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -219,7 +219,8 @@ void RPCHandlerImpl::GetMessageVersion(
}
utils::SemanticVersion temp_version(major, minor, patch);
if (temp_version.isValid()) {
- message_version = temp_version;
+ utils::SemanticVersion ver_4_5(4, 5, 0);
+ message_version = (temp_version > ver_4_5) ? temp_version : ver_4_5;
}
}
}
@@ -251,10 +252,7 @@ bool RPCHandlerImpl::ConvertMessageToSO(
// Attach RPC version to SmartObject if it does not exist yet.
auto app_ptr = app_manager_.application(message.connection_key());
utils::SemanticVersion msg_version(0, 0, 0);
- if (app_ptr &&
- (output[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS]
- .keyExists(NsSmartDeviceLink::NsJSONHandler::strings::
- S_RPC_MSG_VERSION) == false)) {
+ if (app_ptr) {
msg_version = app_ptr->msg_version();
} else if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
static_cast<mobile_apis::FunctionID::eType>(