summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2017-07-27 11:31:58 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2017-07-27 11:31:58 -0400
commit38cf82c7b69af9f98fa0cc3bad8d1d86dcb6f618 (patch)
treefc13c78a82dcd07b8372d8c127be32a9d4e74c75
parentd790b9e7ee173b95abed7e5c863f3813c6e404f8 (diff)
downloadsdl_core-38cf82c7b69af9f98fa0cc3bad8d1d86dcb6f618.tar.gz
Add kV5 to ProtocolVersion enum
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h3
-rw-r--r--src/components/application_manager/include/application_manager/message.h3
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc11
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc10
-rw-r--r--src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc8
-rw-r--r--src/components/application_manager/test/mobile_message_handler_test.cc4
9 files changed, 39 insertions, 22 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 0e6f598a9c..e6148a3c1d 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -1082,7 +1082,8 @@ class ApplicationManagerImpl
bool operator()(const ApplicationSharedPtr app) const {
return app
? handle_ == app->device() &&
- ProtocolVersion::kV4 == app->protocol_version()
+ ProtocolVersion::kV4 <= app->protocol_version() &&
+ ProtocolVersion::kV5 >= app->protocol_version()
: false;
}
};
diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h
index fe903393fb..53b2271de8 100644
--- a/src/components/application_manager/include/application_manager/message.h
+++ b/src/components/application_manager/include/application_manager/message.h
@@ -63,7 +63,8 @@ enum ProtocolVersion {
kV1 = 1,
kV2 = 2,
kV3 = 3,
- kV4 = 4
+ kV4 = 4,
+ kV5 = 5
};
class Message {
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 097abc4645..8c792750a8 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -1802,6 +1802,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
<< message.json_message());
switch (message.protocol_version()) {
+ case ProtocolVersion::kV5:
case ProtocolVersion::kV4:
case ProtocolVersion::kV3:
case ProtocolVersion::kV2: {
@@ -3458,7 +3459,13 @@ ProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const {
LOG4CXX_AUTO_TRACE(logger_);
bool heart_beat_support = get_settings().heart_beat_timeout();
bool sdl4_support = protocol_handler_->get_settings().enable_protocol_4();
+ bool sdl5_support = protocol_handler_->get_settings().enable_protocol_5();
+ if (sdl5_support) {
+ LOG4CXX_DEBUG(logger_,
+ "SDL Supported protocol version " << ProtocolVersion::kV5);
+ return ProtocolVersion::kV5;
+ }
if (sdl4_support) {
LOG4CXX_DEBUG(logger_,
"SDL Supported protocol version " << ProtocolVersion::kV4);
diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
index 3a5a8d25f9..1abe38c5fe 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
@@ -46,7 +46,8 @@ struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> {
bool operator()(const ApplicationSharedPtr app) const {
return app
? handle_ == app->device() &&
- ProtocolVersion::kV4 == app->protocol_version()
+ ProtocolVersion::kV4 <= app->protocol_version() &&
+ ProtocolVersion::kV5 >= app->protocol_version()
: false;
}
};
diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
index 9b16bd3572..58fd571d08 100644
--- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
+++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
@@ -75,10 +75,11 @@ void OnHMIStatusNotificationFromMobile::Run() {
<< connection_key() << " and handle: " << handle);
if (!is_apps_requested_before &&
- ProtocolVersion::kV4 == app->protocol_version() && app->is_foreground()) {
+ ProtocolVersion::kV4 <= app->protocol_version() &&
+ ProtocolVersion::kV5 >= app->protocol_version() && app->is_foreground()) {
// In case this notification will be received from mobile side with
// foreground level for app on mobile, this should trigger remote
- // apps list query for SDL 4.0 app
+ // apps list query for SDL 4.0+ app
MessageHelper::SendQueryApps(connection_key(), application_manager_);
return;
}
@@ -89,7 +90,8 @@ void OnHMIStatusNotificationFromMobile::Run() {
" for handle: "
<< handle);
- if (ProtocolVersion::kV4 == app->protocol_version()) {
+ if (ProtocolVersion::kV4 <= app->protocol_version() &&
+ ProtocolVersion::kV5 >= app->protocol_version()) {
const ApplicationSet& accessor =
application_manager_.applications().GetData();
@@ -97,7 +99,8 @@ void OnHMIStatusNotificationFromMobile::Run() {
ApplicationSetConstIt it = accessor.begin();
for (; accessor.end() != it; ++it) {
if (connection_key() != (*it)->app_id() &&
- ProtocolVersion::kV4 == (*it)->protocol_version() &&
+ ProtocolVersion::kV4 <= (*it)->protocol_version() &&
+ ProtocolVersion::kV5 >= (*it)->protocol_version() &&
(*it)->is_foreground()) {
is_another_foreground_sdl4_app = true;
break;
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index b635cb1f84..5dddf42825 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -87,6 +87,11 @@ MobileMessageHandler::HandleIncomingMessageProtocol(
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
+ case ProtocolVersion::kV5:
+ LOG4CXX_DEBUG(logger_, "Protocol version - V5");
+ out_message =
+ MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
+ break;
default:
LOG4CXX_WARN(logger_, "Can't recognise protocol version");
out_message = NULL;
@@ -119,9 +124,8 @@ MobileMessageHandler::HandleOutgoingMessageProtocol(
if (message->protocol_version() == application_manager::kV1) {
return MobileMessageHandler::HandleOutgoingMessageProtocolV1(message);
}
- if ((message->protocol_version() == application_manager::kV2) ||
- (message->protocol_version() == application_manager::kV3) ||
- (message->protocol_version() == application_manager::kV4)) {
+ if ((message->protocol_version() >= application_manager::kV2) &&
+ (message->protocol_version() <= application_manager::kV5)) {
return MobileMessageHandler::HandleOutgoingMessageProtocolV2(message);
}
return NULL;
diff --git a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
index eeae0422d1..a2fc214b95 100644
--- a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
@@ -209,9 +209,9 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false));
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV4));
+ .WillByDefault(Return(am::ProtocolVersion::kV5));
ON_CALL(*mock_app, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV4));
+ .WillByDefault(Return(am::ProtocolVersion::kV5));
const std::string url = "url";
ON_CALL(*mock_app_first, SchemaUrl()).WillByDefault(Return(url));
@@ -291,7 +291,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) {
app_list_.insert(mock_app_first);
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV4));
+ .WillByDefault(Return(am::ProtocolVersion::kV5));
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
@@ -355,7 +355,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV4));
+ .WillByDefault(Return(am::ProtocolVersion::kV5));
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(true));
@@ -389,7 +389,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV4));
+ .WillByDefault(Return(am::ProtocolVersion::kV5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false));
EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
@@ -423,7 +423,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
app_list_.insert(mock_app_first);
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV4));
+ .WillByDefault(Return(am::ProtocolVersion::kV5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
index 2cfed4a26a..37ed397b75 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -91,7 +91,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app, protocol_version())
- .WillRepeatedly(Return(ProtocolVersion::kV4));
+ .WillRepeatedly(Return(ProtocolVersion::kV5));
EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true));
command->Run();
@@ -144,7 +144,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app, protocol_version())
- .WillRepeatedly(Return(ProtocolVersion::kV4));
+ .WillRepeatedly(Return(ProtocolVersion::kV5));
EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true));
command->Run();
@@ -224,7 +224,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(false));
EXPECT_CALL(*mock_app, protocol_version())
- .WillOnce(Return(ProtocolVersion::kV4));
+ .WillOnce(Return(ProtocolVersion::kV5));
EXPECT_CALL(app_mngr_, applications()).Times(0);
@@ -261,7 +261,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app, protocol_version())
- .WillRepeatedly(Return(ProtocolVersion::kV4));
+ .WillRepeatedly(Return(ProtocolVersion::kV5));
EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(false));
EXPECT_CALL(app_mngr_, MarkAppsGreyOut(kHandle, false));
diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc
index 07b523c56e..0fe6018aa7 100644
--- a/src/components/application_manager/test/mobile_message_handler_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_test.cc
@@ -270,7 +270,7 @@ TEST_F(
size_t payload_size = data.size();
std::srand(time(0));
// Generate unknown random protocol version except 1-3
- uint32_t protocol_version = 4 + rand() % UINT32_MAX;
+ uint32_t protocol_version = 5 + rand() % UINT32_MAX;
Message* message =
HandleIncomingMessage(protocol_version, data, payload_size);
@@ -288,7 +288,7 @@ TEST_F(
const uint32_t correlation_id = 92u;
const uint32_t connection_key = 1u;
// Generate unknown random protocol version except 1-3
- uint32_t protocol_version = 4 + rand() % UINT32_MAX;
+ uint32_t protocol_version = 5 + rand() % UINT32_MAX;
MobileMessage message_to_send = CreateMessageForSending(
protocol_version, function_id, correlation_id, connection_key, data);