summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2017-08-08 13:54:03 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2017-08-08 13:54:03 -0400
commit0000726af268818012618c84a925c01a7b0cc0bc (patch)
treeed3500432ecf0c71cfeb3c1b41c9faa1080293d2
parent83c9502e5ccb3e78ff40b9ef2f110ced17e914cd (diff)
downloadsdl_core-fix/merge_protocol_version_enums.tar.gz
Use one enum for shorthand Protocol Version rather than twofix/merge_protocol_version_enums
-rw-r--r--src/components/application_manager/include/application_manager/application.h4
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h7
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h8
-rw-r--r--src/components/application_manager/include/application_manager/message.h22
-rw-r--r--src/components/application_manager/src/application_impl.cc8
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc69
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc6
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc15
-rw-r--r--src/components/application_manager/src/message.cc16
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc4
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc22
-rw-r--r--src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc20
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h4
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc3
-rw-r--r--src/components/application_manager/test/mobile_message_handler_test.cc4
-rw-r--r--src/components/application_manager/test/mobile_message_handler_v1_test.cc6
-rw-r--r--src/components/hmi_message_handler/src/dbus_message_adapter.cc3
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc3
-rw-r--r--src/components/include/protocol/common.h5
21 files changed, 145 insertions, 104 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 63d9580758..9543193ff9 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -542,8 +542,8 @@ class Application : public virtual InitialApplicationData,
virtual void set_grammar_id(uint32_t value) = 0;
virtual void set_protocol_version(
- const ProtocolVersion& protocol_version) = 0;
- virtual ProtocolVersion protocol_version() const = 0;
+ const protocol_handler::MajorProtocolVersion& protocol_version) = 0;
+ virtual protocol_handler::MajorProtocolVersion protocol_version() const = 0;
virtual void set_is_resuming(bool is_resuming) = 0;
virtual bool is_resuming() const = 0;
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 695d7ef9d5..9ef2fb936c 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -162,8 +162,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
virtual void set_grammar_id(uint32_t value);
bool is_audio() const OVERRIDE;
- virtual void set_protocol_version(const ProtocolVersion& protocol_version);
- virtual ProtocolVersion protocol_version() const;
+ virtual void set_protocol_version(
+ const protocol_handler::MajorProtocolVersion& protocol_version);
+ virtual protocol_handler::MajorProtocolVersion protocol_version() const;
virtual void set_is_resuming(bool is_resuming);
virtual bool is_resuming() const;
@@ -370,7 +371,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
std::set<mobile_apis::ButtonName::eType> subscribed_buttons_;
VehicleInfoSubscriptions subscribed_vehicle_info_;
UsageStatistics usage_report_;
- ProtocolVersion protocol_version_;
+ protocol_handler::MajorProtocolVersion protocol_version_;
bool is_voice_communication_application_;
sync_primitives::atomic_bool is_resuming_;
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 93c139963a..313219116d 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
@@ -1086,8 +1086,10 @@ class ApplicationManagerImpl
bool operator()(const ApplicationSharedPtr app) const {
return app
? handle_ == app->device() &&
- Message::is_sufficient_version(ProtocolVersion::kV4,
- app->protocol_version())
+ Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion::
+ PROTOCOL_VERSION_4,
+ app->protocol_version())
: false;
}
};
@@ -1354,7 +1356,7 @@ class ApplicationManagerImpl
* @brief Function returns supported SDL Protocol Version
* @return protocol version depends on parameters from smartDeviceLink.ini.
*/
- ProtocolVersion SupportedSDLVersion() const;
+ protocol_handler::MajorProtocolVersion SupportedSDLVersion() const;
/**
* @brief Types of directories used by Application Manager
diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h
index 4678e88106..70d80f44ef 100644
--- a/src/components/application_manager/include/application_manager/message.h
+++ b/src/components/application_manager/include/application_manager/message.h
@@ -39,6 +39,7 @@
#include "utils/shared_ptr.h"
#include "protocol/message_priority.h"
#include "protocol/rpc_type.h"
+#include "protocol/common.h"
#include "smart_objects/smart_object.h"
namespace application_manager {
@@ -57,16 +58,6 @@ enum MessageType {
// Map PrcType to corresponding MessageType
MessageType MessageTypeFromRpcType(protocol_handler::RpcType rpc_type);
-enum ProtocolVersion {
- kUnknownProtocol = -1,
- kHMI = 0,
- kV1 = 1,
- kV2 = 2,
- kV3 = 3,
- kV4 = 4,
- kV5 = 5
-};
-
class Message {
public:
Message(protocol_handler::MessagePriority priority);
@@ -81,7 +72,7 @@ class Message {
int32_t connection_key() const;
MessageType type() const;
- ProtocolVersion protocol_version() const;
+ protocol_handler::MajorProtocolVersion protocol_version() const;
const std::string& json_message() const;
const BinaryData* binary_data() const;
@@ -97,13 +88,14 @@ class Message {
void set_message_type(MessageType type);
void set_binary_data(BinaryData* data);
void set_json_message(const std::string& json_message);
- void set_protocol_version(ProtocolVersion version);
+ void set_protocol_version(protocol_handler::MajorProtocolVersion version);
void set_smart_object(const smart_objects::SmartObject& object);
void set_data_size(size_t data_size);
void set_payload_size(size_t payload_size);
- static bool is_sufficient_version(ProtocolVersion minVersion,
- ProtocolVersion version);
+ static bool is_sufficient_version(
+ protocol_handler::MajorProtocolVersion minVersion,
+ protocol_handler::MajorProtocolVersion version);
protocol_handler::MessagePriority Priority() const {
return priority_;
@@ -126,7 +118,7 @@ class Message {
BinaryData* binary_data_;
size_t data_size_;
size_t payload_size_;
- ProtocolVersion version_;
+ protocol_handler::MajorProtocolVersion version_;
};
} // namespace application_manager
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 21039e1865..7e9215b0be 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -107,7 +107,8 @@ ApplicationImpl::ApplicationImpl(
, device_(0)
, mac_address_(mac_address)
, usage_report_(mobile_app_id, statistics_manager)
- , protocol_version_(ProtocolVersion::kV3)
+ , protocol_version_(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)
, is_voice_communication_application_(false)
, is_resuming_(false)
, video_stream_retry_number_(0)
@@ -617,11 +618,12 @@ bool ApplicationImpl::set_activated(bool is_active) {
}
void ApplicationImpl::set_protocol_version(
- const ProtocolVersion& protocol_version) {
+ const protocol_handler::MajorProtocolVersion& protocol_version) {
protocol_version_ = protocol_version;
}
-ProtocolVersion ApplicationImpl::protocol_version() const {
+protocol_handler::MajorProtocolVersion ApplicationImpl::protocol_version()
+ const {
return protocol_version_;
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index e7e7868102..0994c7bb80 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -546,15 +546,18 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
version.max_supported_api_version = static_cast<APIVersion>(max_version);
application->set_version(version);
- ProtocolVersion protocol_version = static_cast<ProtocolVersion>(
- message[strings::params][strings::protocol_version].asInt());
+ protocol_handler::MajorProtocolVersion protocol_version =
+ static_cast<protocol_handler::MajorProtocolVersion>(
+ message[strings::params][strings::protocol_version].asInt());
application->set_protocol_version(protocol_version);
- if (ProtocolVersion::kUnknownProtocol != protocol_version) {
+ if (protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN !=
+ protocol_version) {
connection_handler().BindProtocolVersionWithSession(
connection_key, static_cast<uint8_t>(protocol_version));
}
- if ((protocol_version == ProtocolVersion::kV3) &&
+ if ((protocol_version ==
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) &&
(get_settings().heart_beat_timeout() != 0)) {
connection_handler().StartSessionHeartBeat(connection_key);
}
@@ -1392,7 +1395,7 @@ void ApplicationManagerImpl::SendMessageToMobile(
((*message)[strings::msg_params][strings::result_code] ==
NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) {
(*message)[strings::params][strings::protocol_version] =
- ProtocolVersion::kV1;
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1;
} else {
(*message)[strings::params][strings::protocol_version] =
SupportedSDLVersion();
@@ -1838,10 +1841,10 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
<< message.json_message());
switch (message.protocol_version()) {
- case ProtocolVersion::kV5:
- case ProtocolVersion::kV4:
- case ProtocolVersion::kV3:
- case ProtocolVersion::kV2: {
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2: {
const bool conversion_result =
formatters::CFormatterJsonSDLRPCv2::fromString(
message.json_message(),
@@ -1893,7 +1896,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
}
break;
}
- case ProtocolVersion::kHMI: {
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI: {
#ifdef ENABLE_LOG
int32_t result =
#endif
@@ -1931,7 +1934,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
}
break;
}
- case ProtocolVersion::kV1: {
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: {
static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema;
if (message.function_id() == 0 || message.type() == kUnknownType) {
@@ -2012,7 +2015,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
- output.set_protocol_version(application_manager::kV1);
+ output.set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
} else {
if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
output_string)) {
@@ -2020,7 +2024,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
return false;
}
output.set_protocol_version(
- static_cast<ProtocolVersion>(protocol_version));
+ static_cast<protocol_handler::MajorProtocolVersion>(
+ protocol_version));
}
break;
@@ -2030,7 +2035,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
- output.set_protocol_version(application_manager::kHMI);
+ output.set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI);
break;
}
default:
@@ -3497,30 +3503,39 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
}
}
-ProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const {
+protocol_handler::MajorProtocolVersion
+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;
+ LOG4CXX_DEBUG(
+ logger_,
+ "SDL Supported protocol version "
+ << protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5);
+ return protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5;
}
if (sdl4_support) {
- LOG4CXX_DEBUG(logger_,
- "SDL Supported protocol version " << ProtocolVersion::kV4);
- return ProtocolVersion::kV4;
+ LOG4CXX_DEBUG(
+ logger_,
+ "SDL Supported protocol version "
+ << protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4);
+ return protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4;
}
if (heart_beat_support) {
- LOG4CXX_DEBUG(logger_,
- "SDL Supported protocol version " << ProtocolVersion::kV3);
- return ProtocolVersion::kV3;
+ LOG4CXX_DEBUG(
+ logger_,
+ "SDL Supported protocol version "
+ << protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3);
+ return protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3;
}
- LOG4CXX_DEBUG(logger_,
- "SDL Supported protocol version " << ProtocolVersion::kV2);
- return ProtocolVersion::kV2;
+ LOG4CXX_DEBUG(
+ logger_,
+ "SDL Supported protocol version "
+ << protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2);
+ return protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
}
event_engine::EventDispatcher& ApplicationManagerImpl::event_dispatcher() {
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 a75eba3ed8..6961c15f76 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,8 +46,10 @@ struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> {
bool operator()(const ApplicationSharedPtr app) const {
return app
? handle_ == app->device() &&
- Message::is_sufficient_version(ProtocolVersion::kV4,
- app->protocol_version())
+ Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion::
+ PROTOCOL_VERSION_4,
+ 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 4952f01bb2..4bb6cfe9d5 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,8 +75,9 @@ void OnHMIStatusNotificationFromMobile::Run() {
<< connection_key() << " and handle: " << handle);
if (!is_apps_requested_before &&
- Message::is_sufficient_version(ProtocolVersion::kV4,
- app->protocol_version()) &&
+ Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4,
+ 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
@@ -91,8 +92,9 @@ void OnHMIStatusNotificationFromMobile::Run() {
" for handle: "
<< handle);
- if (Message::is_sufficient_version(ProtocolVersion::kV4,
- app->protocol_version())) {
+ if (Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4,
+ app->protocol_version())) {
const ApplicationSet& accessor =
application_manager_.applications().GetData();
@@ -100,8 +102,9 @@ void OnHMIStatusNotificationFromMobile::Run() {
ApplicationSetConstIt it = accessor.begin();
for (; accessor.end() != it; ++it) {
if (connection_key() != (*it)->app_id() &&
- Message::is_sufficient_version(ProtocolVersion::kV4,
- (*it)->protocol_version()) &&
+ Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4,
+ (*it)->protocol_version()) &&
(*it)->is_foreground()) {
is_another_foreground_sdl4_app = true;
break;
diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc
index 48333d4e6f..41a7eea0b6 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -64,7 +64,8 @@ Message::Message(protocol_handler::MessagePriority priority)
, binary_data_(NULL)
, data_size_(0)
, payload_size_(0)
- , version_(kUnknownProtocol) {}
+ , version_(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN) {}
Message::Message(const Message& message)
: priority_(message.priority_), binary_data_(NULL) {
@@ -129,7 +130,7 @@ MessageType Message::type() const {
return type_;
}
-ProtocolVersion Message::protocol_version() const {
+protocol_handler::MajorProtocolVersion Message::protocol_version() const {
return version_;
}
@@ -186,7 +187,8 @@ void Message::set_json_message(const std::string& json_message) {
json_message_ = json_message;
}
-void Message::set_protocol_version(ProtocolVersion version) {
+void Message::set_protocol_version(
+ protocol_handler::MajorProtocolVersion version) {
version_ = version;
}
@@ -206,8 +208,10 @@ void Message::set_payload_size(size_t payload_size) {
payload_size_ = payload_size;
}
-bool Message::is_sufficient_version(ProtocolVersion minVersion,
- ProtocolVersion version) {
- return version >= minVersion && version <= ProtocolVersion::kV5;
+bool Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion minVersion,
+ protocol_handler::MajorProtocolVersion version) {
+ return version >= minVersion &&
+ version <= protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5;
}
} // namespace application_manager
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 19bb658bca..8e1b4aa125 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -619,8 +619,8 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
(*response)[strings::params][strings::connection_key] = connection_key;
(*response)[strings::params][strings::protocol_type] =
commands::CommandImpl::mobile_protocol_type_;
- (*response)[strings::params][strings::protocol_version] =
- static_cast<int>(kV2);
+ (*response)[strings::params][strings::protocol_version] = static_cast<int>(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2);
return response;
}
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index 88f78ec596..f7beea670e 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -67,27 +67,27 @@ MobileMessageHandler::HandleIncomingMessageProtocol(
DCHECK_OR_RETURN(message, NULL);
application_manager::Message* out_message = NULL;
switch (message->protocol_version()) {
- case ProtocolVersion::kV1:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1:
LOG4CXX_DEBUG(logger_, "Protocol version - V1");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
break;
- case ProtocolVersion::kV2:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2:
LOG4CXX_DEBUG(logger_, "Protocol version - V2");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
- case ProtocolVersion::kV3:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3:
LOG4CXX_DEBUG(logger_, "Protocol version - V3");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
- case ProtocolVersion::kV4:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4:
LOG4CXX_DEBUG(logger_, "Protocol version - V4");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
break;
- case ProtocolVersion::kV5:
+ case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5:
LOG4CXX_DEBUG(logger_, "Protocol version - V5");
out_message =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
@@ -121,11 +121,13 @@ MobileMessageHandler::HandleOutgoingMessageProtocol(
<< message->correlation_id() << ", "
<< message->json_message());
- if (message->protocol_version() == application_manager::kV1) {
+ if (message->protocol_version() ==
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1) {
return MobileMessageHandler::HandleOutgoingMessageProtocolV1(message);
}
- if (Message::is_sufficient_version(ProtocolVersion::kV2,
- message->protocol_version())) {
+ if (Message::is_sufficient_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2,
+ message->protocol_version())) {
return MobileMessageHandler::HandleOutgoingMessageProtocolV2(message);
}
return NULL;
@@ -146,7 +148,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1(
outgoing_message->set_connection_key(message->connection_key());
outgoing_message->set_protocol_version(
- static_cast<application_manager::ProtocolVersion>(
+ static_cast<protocol_handler::MajorProtocolVersion>(
message->protocol_version()));
outgoing_message->set_json_message(std::string(
reinterpret_cast<const char*>(message->data()), message->data_size()));
@@ -188,7 +190,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
outgoing_message->set_correlation_id(int32_t(payload.header.correlation_id));
outgoing_message->set_connection_key(message->connection_key());
outgoing_message->set_protocol_version(
- static_cast<application_manager::ProtocolVersion>(
+ static_cast<protocol_handler::MajorProtocolVersion>(
message->protocol_version()));
outgoing_message->set_data_size(message->data_size());
outgoing_message->set_payload_size(message->payload_size());
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 a2fc214b95..3805df5834 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,11 @@ 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::kV5));
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
ON_CALL(*mock_app, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV5));
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
const std::string url = "url";
ON_CALL(*mock_app_first, SchemaUrl()).WillByDefault(Return(url));
@@ -291,7 +293,8 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) {
app_list_.insert(mock_app_first);
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV5));
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
@@ -355,7 +358,8 @@ 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::kV5));
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(true));
@@ -389,7 +393,8 @@ 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::kV5));
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false));
EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
@@ -423,7 +428,8 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
app_list_.insert(mock_app_first);
ON_CALL(*mock_app_first, protocol_version())
- .WillByDefault(Return(am::ProtocolVersion::kV5));
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
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 37ed397b75..34f8a010d8 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
@@ -52,7 +52,7 @@ const connection_handler::DeviceHandle kHandle = 2u;
namespace strings = application_manager::strings;
using application_manager::commands::OnHMIStatusNotificationFromMobile;
-using application_manager::ProtocolVersion;
+using protocol_handler::MajorProtocolVersion;
using application_manager::ApplicationSet;
using testing::Mock;
using testing::Return;
@@ -91,7 +91,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app, protocol_version())
- .WillRepeatedly(Return(ProtocolVersion::kV5));
+ .WillRepeatedly(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true));
command->Run();
@@ -144,7 +145,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app, protocol_version())
- .WillRepeatedly(Return(ProtocolVersion::kV5));
+ .WillRepeatedly(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(true));
command->Run();
@@ -172,7 +174,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).Times(0);
EXPECT_CALL(*mock_app, protocol_version())
- .WillOnce(Return(ProtocolVersion::kV3));
+ .WillOnce(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3));
EXPECT_CALL(*mock_app, is_foreground()).Times(0);
command->Run();
@@ -199,7 +202,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).Times(0);
EXPECT_CALL(*mock_app, protocol_version())
- .WillOnce(Return(ProtocolVersion::kV3));
+ .WillOnce(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3));
EXPECT_CALL(*mock_app, is_foreground()).Times(0);
command->Run();
@@ -224,7 +228,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, IsAppsQueriedFrom(kHandle)).WillOnce(Return(false));
EXPECT_CALL(*mock_app, protocol_version())
- .WillOnce(Return(ProtocolVersion::kV5));
+ .WillOnce(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(app_mngr_, applications()).Times(0);
@@ -261,7 +266,8 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app, protocol_version())
- .WillRepeatedly(Return(ProtocolVersion::kV5));
+ .WillRepeatedly(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app, is_foreground()).WillRepeatedly(Return(false));
EXPECT_CALL(app_mngr_, MarkAppsGreyOut(kHandle, false));
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
index 8f2ce3d3dc..2da0e60df1 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -49,7 +49,7 @@ const uint32_t kConnectionKey = 1u;
namespace strings = application_manager::strings;
using application_manager::commands::OnHMIStatusNotification;
-using application_manager::ProtocolVersion;
+using protocol_handler::MajorProtocolVersion;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
using testing::Mock;
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 3276e1f8f5..ae9b05bb92 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -123,9 +123,9 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_grammar_id, void(uint32_t value));
MOCK_METHOD1(
set_protocol_version,
- void(const ::application_manager::ProtocolVersion& protocol_version));
+ void(const ::protocol_handler::MajorProtocolVersion& protocol_version));
MOCK_CONST_METHOD0(protocol_version,
- ::application_manager::ProtocolVersion());
+ ::protocol_handler::MajorProtocolVersion());
MOCK_METHOD1(set_is_resuming, void(bool));
MOCK_CONST_METHOD0(is_resuming, bool());
MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file));
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index 94ab511dc4..3471c02901 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -96,7 +96,8 @@ TEST(MessageHelperTestCreate,
obj[strings::params][strings::correlation_id].asUInt());
EXPECT_EQ(connection_key,
obj[strings::params][strings::connection_key].asUInt());
- EXPECT_EQ(kV2, obj[strings::params][strings::protocol_version].asInt());
+ EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2,
+ obj[strings::params][strings::protocol_version].asInt());
}
TEST(MessageHelperTestCreate, CreateSetAppIcon_SendNullPathImagetype_Equal) {
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 0fe6018aa7..3f2ba0a3c5 100644
--- a/src/components/application_manager/test/mobile_message_handler_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_test.cc
@@ -53,7 +53,7 @@ using protocol_handler::ServiceType;
using protocol_handler::MessagePriority;
using protocol_handler::PROTOCOL_HEADER_V2_SIZE;
using application_manager::MobileMessageHandler;
-using application_manager::ProtocolVersion;
+using protocol_handler::MajorProtocolVersion;
using ::testing::_;
using ::application_manager::Message;
using ::application_manager::MobileMessage;
@@ -176,7 +176,7 @@ class MobileMessageHandlerTest : public testing::Test {
message->set_correlation_id(correlation_id);
message->set_connection_key(connection_key);
message->set_protocol_version(
- static_cast<ProtocolVersion>(protocol_version));
+ static_cast<protocol_handler::MajorProtocolVersion>(protocol_version));
message->set_message_type(application_manager::MessageType::kNotification);
if (data) {
message->set_binary_data(data);
diff --git a/src/components/application_manager/test/mobile_message_handler_v1_test.cc b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
index f5a6e7833d..a19ea991b9 100644
--- a/src/components/application_manager/test/mobile_message_handler_v1_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
@@ -111,7 +111,8 @@ TEST(MobileMessageHandlerTestV1Test,
utils::MakeShared<application_manager::Message>(
protocol_handler::MessagePriority::kDefault);
- message->set_protocol_version(application_manager::ProtocolVersion::kV1);
+ message->set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
message->set_json_message(data_json);
message->set_connection_key(connection_key_p1);
@@ -121,7 +122,8 @@ TEST(MobileMessageHandlerTestV1Test,
ASSERT_TRUE(ptr);
EXPECT_EQ(connection_key, ptr->connection_key());
- EXPECT_EQ(static_cast<uint32_t>(application_manager::ProtocolVersion::kV1),
+ EXPECT_EQ(static_cast<uint32_t>(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1),
ptr->protocol_version());
}
diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
index 00f5ad6be8..5b0b11e557 100644
--- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc
+++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
@@ -179,7 +179,8 @@ void DBusMessageAdapter::SendMessageToCore(
// merge
// MessagePriority::FromServiceType(message.servicetype)
// shall be used instead
- message->set_protocol_version(application_manager::ProtocolVersion::kHMI);
+ message->set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI);
message->set_smart_object(obj);
handler()->OnMessageReceived(message);
LOG4CXX_INFO(logger_, "Successfully sent to observer");
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index 27cf9df8cd..39cae7ea76 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -171,7 +171,8 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) {
protocol_handler::MessagePriority::kDefault));
// message->set_message_type()
message->set_json_message(message_string);
- message->set_protocol_version(application_manager::ProtocolVersion::kHMI);
+ message->set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI);
if (!handler()) {
LOG4CXX_WARN(logger_, "handler is NULL");
diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h
index 2904f383de..00d57a9bf5 100644
--- a/src/components/include/protocol/common.h
+++ b/src/components/include/protocol/common.h
@@ -56,8 +56,9 @@ const uint8_t PROTOCOL_HEADER_V2_SIZE = 12;
*\brief Protocol versions constants
* First 4-bit field of AppLink protocol packet
*/
-enum {
-
+enum MajorProtocolVersion {
+ PROTOCOL_VERSION_UNKNOWN = -1,
+ PROTOCOL_VERSION_HMI = 0x00,
/**
*\brief Constant: number of protocol version (1).
*/