summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc21
-rw-r--r--src/components/include/utils/semantic_version.h24
2 files changed, 23 insertions, 22 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 672864c422..cd566e43fd 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
@@ -311,7 +311,17 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- application->set_msg_version(major, minor, patch);
+ //Version negotiation
+ utils::SemanticVersion mobile_version(major, minor, patch);
+ utils::SemanticVersion module_version(major_version, minor_version, patch_version);
+ if (mobile_version < module_version) {
+ //Use mobile RPC version as negotiated version
+ application->set_msg_version(major, minor, patch);
+ } else {
+ //Use module version as negotiated version
+ application->set_msg_version(major_version, minor_version, patch_version);
+ }
+
// For resuming application need to restore hmi_app_id from resumeCtrl
resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
@@ -599,12 +609,15 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
return;
}
+
+ utils::SemanticVersion negotiated_version = application->msg_version();
+
response_params[strings::sync_msg_version][strings::major_version] =
- major_version; // From generated file interfaces/generated_msg_version.h
+ negotiated_version.major_version;
response_params[strings::sync_msg_version][strings::minor_version] =
- minor_version; // From generated file interfaces/generated_msg_version.h
+ negotiated_version.minor_version;
response_params[strings::sync_msg_version][strings::patch_version] =
- patch_version; // From generated file interfaces/generated_msg_version.h
+ negotiated_version.patch_version;
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
diff --git a/src/components/include/utils/semantic_version.h b/src/components/include/utils/semantic_version.h
index aca61f4810..efa3b2e92d 100644
--- a/src/components/include/utils/semantic_version.h
+++ b/src/components/include/utils/semantic_version.h
@@ -66,15 +66,9 @@ struct SemanticVersion {
}
bool operator<(const SemanticVersion& version) const {
- if(major_version < version.major_version) {
- return true;
- } else if (minor_version < version.minor_version) {
- return true;
- } else if (patch_version < version.patch_version) {
- return true;
- } else {
- return false;
- }
+ return (major_version < version.major_version) ||
+ ((major_version == version.major_version) && (minor_version < version.minor_version)) ||
+ ((major_version == version.major_version) && (minor_version == version.minor_version) && (patch_version < version.patch_version));
}
bool operator<=(const SemanticVersion& version) const {
@@ -88,15 +82,9 @@ struct SemanticVersion {
}
bool operator>(const SemanticVersion& version) const {
- if(major_version > version.major_version) {
- return true;
- } else if (minor_version > version.minor_version) {
- return true;
- } else if (patch_version > version.patch_version) {
- return true;
- } else {
- return false;
- }
+ return (major_version > version.major_version) ||
+ ((major_version == version.major_version) && (minor_version > version.minor_version)) ||
+ ((major_version == version.major_version) && (minor_version == version.minor_version) && (patch_version > version.patch_version));
}
bool operator>=(const SemanticVersion& version) const {