diff options
author | Polina Vyshnevska <PVyshnevska@luxoft.com> | 2014-04-07 12:41:50 +0300 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2014-07-09 13:59:53 -0400 |
commit | 261d0839194deeb861da9d09d9f39f79ff55ecd6 (patch) | |
tree | 5c5444a047856056f000a3ae38d760fad7eeb055 | |
parent | a4365f7a5913ae3d00418f54c5226117d9851dcb (diff) | |
download | smartdevicelink-261d0839194deeb861da9d09d9f39f79ff55ecd6.tar.gz |
Not a subject for review
Reason: Mergining issues solving.
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Conflicts:
src/components/application_manager/src/application_manager_impl.cc
-rw-r--r-- | src/appMain/sdl_preloaded_pt.json | 54 | ||||
-rw-r--r-- | src/components/application_manager/src/application_manager_impl.cc | 101 |
2 files changed, 25 insertions, 130 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index ddc69b2dc..5593e164d 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -232,7 +232,7 @@ "PerformInteraction": {
"hmi_levels": [
"FULL",
- "LIMITED"
+ "LIMITED"
]
},
"PutFile": {
@@ -429,18 +429,6 @@ "BACKGROUND",
"FULL",
"LIMITED"
- ],
- "parameters": [
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus"
]
},
"OnVehicleData": {
@@ -448,18 +436,6 @@ "BACKGROUND",
"FULL",
"LIMITED"
- ],
- "parameters": [
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus"
]
},
"SubscribeVehicleData": {
@@ -467,17 +443,6 @@ "BACKGROUND",
"FULL",
"LIMITED"
- ],
- "parameters": [
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "wiperStatus"
]
},
"UnsubscribeVehicleData": {
@@ -485,17 +450,6 @@ "BACKGROUND",
"FULL",
"LIMITED"
- ],
- "parameters": [
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "wiperStatus"
]
}
}
@@ -1920,7 +1874,9 @@ "priority": "NONE",
"default_hmi": "NONE",
"groups": [
- "Base-4"
+ "Base-4",
+ "VehicleInfo-3",
+ "PropriataryData-1"
]
},
"device": {
@@ -1934,4 +1890,4 @@ }
}
}
-}
\ No newline at end of file +}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index c3c03320c..2e33f2e17 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -346,9 +346,6 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( 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_); @@ -686,7 +683,6 @@ void ApplicationManagerImpl::OnMessageReceived( } utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message); - if (outgoing_message) { messages_from_mobile_.PostMessage( impl::MessageFromMobile(outgoing_message)); @@ -728,7 +724,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated( 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] = 3; + so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 2; 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( @@ -908,26 +904,6 @@ void ApplicationManagerImpl::SendMessageToMobile( return; } - ApplicationSharedPtr app = application( - (*message)[strings::params][strings::connection_key].asUInt()); - - if (!app) { - LOG4CXX_ERROR_EXT(logger_, - "No application associated with connection key"); - 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 { - (*message)[strings::params][strings::protocol_version] = - app->protocol_version(); - } - mobile_so_factory().attachSchema(*message); LOG4CXX_INFO( logger_, @@ -1004,7 +980,7 @@ bool ApplicationManagerImpl::ManageMobileCommand( correlation_id, static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED)); - SendMessageToMobile(response); + ApplicationManagerImpl::instance()->SendMessageToMobile(response); return false; } @@ -1070,7 +1046,7 @@ bool ApplicationManagerImpl::ManageMobileCommand( correlation_id, static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS)); - SendMessageToMobile(response); + ApplicationManagerImpl::instance()->SendMessageToMobile(response); return false; } else if (result == request_controller::RequestController::TOO_MANY_REQUESTS) { @@ -1213,8 +1189,8 @@ bool ApplicationManagerImpl::ConvertMessageToSO( << "; json " << message.json_message()); switch (message.protocol_version()) { - case ProtocolVersion::kV3: case ProtocolVersion::kV2: { + if (!formatters::CFormatterJsonSDLRPCv2::fromString( message.json_message(), output, @@ -1239,8 +1215,6 @@ 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()); @@ -1356,10 +1330,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( LOG4CXX_WARN(logger_, "Failed to serialize smart object"); return false; } - output.set_protocol_version( - static_cast<ProtocolVersion>( - message.getElement(jhs::S_PARAMS).getElement( - jhs::S_PROTOCOL_VERSION).asUInt())); + output.set_protocol_version(application_manager::kV2); } break; @@ -1435,8 +1406,7 @@ utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( if (message->protocol_version() == 1) { convertion_result = MobileMessageHandler::HandleIncomingMessageProtocolV1(message); - } else if ((message->protocol_version() == 2) || - (message->protocol_version() == 3)) { + } else if (message->protocol_version() == 2) { convertion_result = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); } else { @@ -1661,8 +1631,7 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile& message) { protocol_handler::RawMessage* rawMessage = 0; if (message->protocol_version() == application_manager::kV1) { rawMessage = MobileMessageHandler::HandleOutgoingMessageProtocolV1(message); - } else if ((message->protocol_version() == application_manager::kV2) || - (message->protocol_version() == application_manager::kV3)) { + } else if (message->protocol_version() == application_manager::kV2) { rawMessage = MobileMessageHandler::HandleOutgoingMessageProtocolV2(message); } else { return; @@ -1747,34 +1716,34 @@ void ApplicationManagerImpl::Unmute(VRTTSSessionChanging changing_state) { } mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( - const std::vector<uint8_t>& binary_data, const std::string& file_path, - const std::string& file_name, const uint32_t offset) { - LOG4CXX_INFO(logger_, - "SaveBinaryWithOffset binary_size = " << binary_data.size() - << " offset = " << offset); + const std::vector<uint8_t>& binary_data, const std::string& file_path, + const uint32_t offset) { + LOG4CXX_INFO( + logger_, + "SaveBinaryWithOffset binary_size = " << binary_data.size() + << " offset = " << offset); - if (binary_data.size() > file_system::GetAvailableDiskSpace(file_path)) { + if (binary_data.size() > file_system::GetAvailableDiskSpace()) { LOG4CXX_ERROR(logger_, "Out of free disc space."); return mobile_apis::Result::OUT_OF_MEMORY; } - const std::string full_file_path = file_path + "/" + file_name; - uint32_t file_size = file_system::FileSize(full_file_path); + uint32_t file_size = file_system::FileSize(file_path); std::ofstream* file_stream; if (offset != 0) { if (file_size != offset) { - LOG4CXX_INFO(logger_, - "ApplicationManagerImpl::SaveBinaryWithOffset offset" - << " does'n match existing file size"); + LOG4CXX_INFO( + logger_, + "ApplicationManagerImpl::SaveBinaryWithOffset offset does'n match existing filesize"); return mobile_apis::Result::INVALID_DATA; } - file_stream = file_system::Open(full_file_path, std::ios_base::app); + file_stream = file_system::Open(file_path, std::ios_base::app); } else { LOG4CXX_INFO( logger_, "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite"); // if offset == 0: rewrite file - file_stream = file_system::Open(full_file_path, std::ios_base::out); + file_stream = file_system::Open(file_path, std::ios_base::out); } if (!file_system::Write(file_stream, binary_data.data(), @@ -1782,41 +1751,11 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( file_system::Close(file_stream); return mobile_apis::Result::GENERIC_ERROR; } - file_system::Close(file_stream); LOG4CXX_INFO(logger_, "Successfully write data to file"); return mobile_apis::Result::SUCCESS; } -uint32_t ApplicationManagerImpl::GetAvailableSpaceForApp( - const std::string& app_name) { - const uint32_t app_quota = profile::Profile::instance()->app_dir_quota(); - std::string app_storage_path = - profile::Profile::instance()->app_storage_folder(); - - app_storage_path += "/"; - app_storage_path += app_name; - - if (file_system::DirectoryExists(app_storage_path)) { - uint32_t size_of_directory = file_system::DirectorySize(app_storage_path); - if (app_quota < size_of_directory) { - return 0; - } - - uint32_t current_app_quota = app_quota - size_of_directory; - uint32_t available_disk_space = - file_system::GetAvailableDiskSpace(app_storage_path); - - if (current_app_quota > available_disk_space) { - return available_disk_space; - } else { - return current_app_quota; - } - } else { - return app_quota; - } -} - bool ApplicationManagerImpl::IsHMICooperating() const { return hmi_cooperating_; } |