application->set_version(version);
application->set_mobile_app_id(message[strings::msg_params][strings::app_id]);
+ application->set_protocol_version(
+ static_cast<ProtocolVersion>(
+ message[strings::params][strings::protocol_version].asInt()));
sync_primitives::AutoLock lock(applications_list_lock_);
return;
}
+ LOG4CXX_INFO(logger_, "RawMessagePtr service type" << message->service_type());
+
utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message);
+
if (outgoing_message) {
messages_from_mobile_.PostMessage(
impl::MessageFromMobile(outgoing_message));
hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
so_to_send[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] =
hmi_apis::messageType::request;
- so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 2;
+ so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 3;
so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1;
so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID();
smart_objects::SmartObject* msg_params = MessageHelper::CreateDeviceListSO(
return;
}
+ LOG4CXX_INFO(
+ logger_,
+ "Connection key: " << (*message)[strings::params][strings::connection_key].asUInt());
+
+ ApplicationSharedPtr app = application(
+ (*message)[strings::params][strings::connection_key].asUInt());
+
+ if (!app) {
+ LOG4CXX_ERROR_EXT(logger_,
+ "No application associated with connection key");
+ (*message)[strings::params][strings::protocol_version] =
+ ProtocolVersion::kV3;
+ return;
+ } else {
+ LOG4CXX_INFO(logger_,
+ "Protocol version: " << app->protocol_version());
+
+ (*message)[strings::params][strings::protocol_version] =
+ app->protocol_version();
+ }
+
+ (*message)[strings::params][strings::protocol_version] =
+ app->protocol_version();
+
mobile_so_factory().attachSchema(*message);
LOG4CXX_INFO(
logger_,
correlation_id,
static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED));
- ApplicationManagerImpl::instance()->SendMessageToMobile(response);
+ SendMessageToMobile(response);
return false;
}
correlation_id,
static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
- ApplicationManagerImpl::instance()->SendMessageToMobile(response);
+ SendMessageToMobile(response);
return false;
} else if (result ==
request_controller::RequestController::TOO_MANY_REQUESTS) {
<< "; json " << message.json_message());
switch (message.protocol_version()) {
+ case ProtocolVersion::kV3:
case ProtocolVersion::kV2: {
-
if (!formatters::CFormatterJsonSDLRPCv2::fromString(
message.json_message(),
output,
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
- output.set_protocol_version(application_manager::kV2);
+ output.set_protocol_version(
+ static_cast<ProtocolVersion>(
+ message.getElement(jhs::S_PARAMS).getElement(
+ jhs::S_PROTOCOL_VERSION).asUInt()));
}
break;
if (message->protocol_version() == 1) {
convertion_result =
MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
- } else if (message->protocol_version() == 2) {
+ } else if ((message->protocol_version() == 2) ||
+ (message->protocol_version() == 3)) {
convertion_result =
MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
} else {
protocol_handler::RawMessage* rawMessage = 0;
if (message->protocol_version() == application_manager::kV1) {
rawMessage = MobileMessageHandler::HandleOutgoingMessageProtocolV1(message);
- } else if (message->protocol_version() == application_manager::kV2) {
+ } else if ((message->protocol_version() == application_manager::kV2) ||
+ (message->protocol_version() == application_manager::kV3)) {
rawMessage = MobileMessageHandler::HandleOutgoingMessageProtocolV2(message);
} else {
return;
case PROTOCOL_VERSION_1:
required_size += PROTOCOL_HEADER_V1_SIZE;
break;
+ case PROTOCOL_VERSION_3:
case PROTOCOL_VERSION_2:
required_size += PROTOCOL_HEADER_V2_SIZE;
break;
LOG4CXX_TRACE_ENTER(logger_);
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- PROTOCOL_VERSION_2, COMPRESS_OFF, FRAME_TYPE_CONTROL,
+ PROTOCOL_VERSION_3, COMPRESS_OFF, FRAME_TYPE_CONTROL,
service_type, FRAME_DATA_START_SERVICE_ACK, session_id,
0, hash_code));
LOG4CXX_TRACE_ENTER(logger_);
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- PROTOCOL_VERSION_2, COMPRESS_OFF, FRAME_TYPE_CONTROL,
+ PROTOCOL_VERSION_3, COMPRESS_OFF, FRAME_TYPE_CONTROL,
SERVICE_TYPE_ZERO, FRAME_DATA_HEART_BEAT_ACK, session_id,
0, message_id));
uint32_t maxDataSize = 0;
if (PROTOCOL_VERSION_1 == message->protocol_version()) {
maxDataSize = MAXIMUM_FRAME_DATA_SIZE - PROTOCOL_HEADER_V1_SIZE;
- } else if (PROTOCOL_VERSION_2 == message->protocol_version()) {
+ } else {
maxDataSize = MAXIMUM_FRAME_DATA_SIZE - PROTOCOL_HEADER_V2_SIZE;
}
const bool is_final_message) {
LOG4CXX_TRACE_ENTER(logger_);
- uint8_t versionF = PROTOCOL_VERSION_1;
- if (2 == protocol_version) {
- versionF = PROTOCOL_VERSION_2;
- }
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- versionF, compress, FRAME_TYPE_SINGLE, service_type, 0,
+ protocol_version, compress, FRAME_TYPE_SINGLE, service_type, 0,
session_id, data_size, message_counters_[session_id]++, data));
raw_ford_messages_to_mobile_.PostMessage(
LOG4CXX_INFO_EXT(
logger_, " data size " << data_size << " maxdata_size " << maxdata_size);
- uint8_t versionF = PROTOCOL_VERSION_1;
- if (2 == protocol_version) {
- versionF = PROTOCOL_VERSION_2;
- }
-
int32_t numOfFrames = 0;
int32_t lastdata_size = 0;
outDataFirstFrame[7] = numOfFrames;
ProtocolFramePtr firstPacket(new protocol_handler::ProtocolPacket(connection_id,
- versionF, compress, FRAME_TYPE_FIRST, service_type, 0,
+ protocol_version, compress, FRAME_TYPE_FIRST, service_type, 0,
session_id, FIRST_FRAME_DATA_SIZE, ++message_counters_[session_id],
outDataFirstFrame));
memcpy(outDataFrame, data + (maxdata_size * i), maxdata_size);
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- versionF, compress, FRAME_TYPE_CONSECUTIVE,
+ protocol_version, compress, FRAME_TYPE_CONSECUTIVE,
service_type, ((i % FRAME_DATA_MAX_VALUE) + 1), session_id,
maxdata_size, message_counters_[session_id], outDataFrame));
memcpy(outDataFrame, data + (maxdata_size * i), lastdata_size);
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- versionF, compress, FRAME_TYPE_CONSECUTIVE,
+ protocol_version, compress, FRAME_TYPE_CONSECUTIVE,
service_type, 0x0, session_id, lastdata_size,
message_counters_[session_id], outDataFrame));
uint8_t current_session_id = packet.session_id();
uint32_t hash_code = 0;
- if (packet.protocol_version() == 2) {
+ if (1 != packet.protocol_version()) {
hash_code = packet.message_id();
}
ServiceTypeFromByte(packet.service_type()));
if (-1 != session_hash_code) {
- if (2 == packet.protocol_version()) {
+ if (1 != packet.protocol_version()) {
if (packet.message_id() != session_hash_code) {
success = false;
}
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
ConnectionID connection_id, const ProtocolPacket& packet) {
- LOG4CXX_INFO(logger_,
- "ProtocolHandlerImpl::HandleControlMessageStartSession"
- << (int) packet.protocol_version() );
LOG4CXX_INFO_EXT(logger_,
- "Version 2 " << (packet.protocol_version() == PROTOCOL_VERSION_2));
+ "Protocol version: " <<
+ static_cast<int>(packet.protocol_version()));
int32_t session_id = session_observer_->OnSessionStartedCallback(
connection_id, packet.session_id(),
uint8_t session_id = 0;
session_observer_->PairFromKey(connection_key, &connection_id, &session_id);
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- PROTOCOL_VERSION_2, COMPRESS_OFF, FRAME_TYPE_CONTROL,
+ PROTOCOL_VERSION_3, COMPRESS_OFF, FRAME_TYPE_CONTROL,
SERVICE_TYPE_NAVI, FRAME_DATA_SERVICE_DATA_ACK,
session_id, 0, number_of_frames));