Not a subject for review
authorVladislav Smenyuk <VSmenyuk@luxoft.com>
Wed, 9 Apr 2014 07:23:23 +0000 (00:23 -0700)
committerJustin Dickow <jjdickow@gmail.com>
Wed, 9 Jul 2014 18:10:41 +0000 (14:10 -0400)
Reason: Local changes

src/components/application_manager/src/application_manager_impl.cc
src/components/protocol_handler/src/protocol_payload.cc
src/components/protocol_handler/src/rpc_type.cc
src/components/protocol_handler/src/service_type.cc

index 98c356d..c3c0332 100644 (file)
@@ -685,8 +685,6 @@ void ApplicationManagerImpl::OnMessageReceived(
     return;
   }
 
-  LOG4CXX_INFO(logger_, "RawMessagePtr service type" << message->service_type());
-
   utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message);
 
   if (outgoing_message) {
@@ -910,30 +908,26 @@ void ApplicationManagerImpl::SendMessageToMobile(
     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;
+     if ((*message)[strings::msg_params].keyExists(strings::result_code) &&
+         ((*message)[strings::msg_params][strings::result_code] ==
+             NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) {
+       (*message)[strings::params][strings::protocol_version] =
+                        ProtocolVersion::kV1;
+     } else {
+       (*message)[strings::params][strings::protocol_version] =
+                ProtocolVersion::kV3;
+     }
    } 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_,
@@ -1245,6 +1239,8 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
         << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
       output[strings::params][strings::connection_key] =
         message.connection_key();
+      output[strings::params][strings::protocol_version] =
+              message.protocol_version();
       if (message.binary_data()) {
         output[strings::params][strings::binary_data] =
           *(message.binary_data());
index c83ed14..eefd428 100644 (file)
@@ -55,7 +55,6 @@ void Extract(utils::BitStream* bs, ProtocolPayloadHeaderV2* headerv2) {
     utils::Extract(bs, &rpc_type, kRpcTypeBits);
     headerv2->rpc_type = RpcTypeFromByte(rpc_type);
     if (headerv2->rpc_type == kRpcTypeReserved) {
-      printf("&&&&&&&");
       bs->MarkBad();
       return;
     }
index fc7f631..49c503b 100644 (file)
@@ -56,10 +56,9 @@ RpcType RpcTypeFromByte(uint8_t byte) {
   RpcType type = RpcType(byte);
   bool supported_type = IsSupported(type);
   if (!supported_type) {
-    LOG4CXX_INFO(g_logger, "Invalid service type RPCfromByte: "<<int32_t(byte));
+    LOG4CXX_INFO(g_logger, "Invalid service type: "<<int32_t(byte));
   }
 
-  LOG4CXX_INFO(g_logger, "Service type RPCfromByte: "<<int32_t(byte));
   return supported_type ? type : kRpcTypeReserved;
 }
 
index b7de276..6bc4896 100644 (file)
@@ -30,7 +30,7 @@ ServiceType ServiceTypeFromByte(uint8_t byte) {
   ServiceType type = ServiceType(byte);
   bool valid_type = IsValid(type);
   if (!valid_type) {
-    LOG4CXX_INFO(g_logger, "Invalid service type RPCfromByte: "<<int32_t(byte))
+    LOG4CXX_INFO(g_logger, "Invalid service type: "<<int32_t(byte))
   }
   return valid_type ? type : kInvalidServiceType;
 }