diff options
Diffstat (limited to 'src/components/application_manager/src/application_manager_impl.cc')
-rw-r--r-- | src/components/application_manager/src/application_manager_impl.cc | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 3e5b2a99a..8c79eb356 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -441,6 +441,7 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::PutApplicationInFull( } if ( result == mobile_api::HMILevel::HMI_FULL) { + app->set_hmi_level(result); MessageHelper::SendActivateAppToHMI(app->app_id()); } return result; @@ -1061,17 +1062,17 @@ void ApplicationManagerImpl::SendMessageToHMI( logger_, "Attached schema to message, result if valid: " << message->isValid()); -#ifdef WEB_HMI +#ifdef HMI_JSON_API if (!ConvertSOtoMessage(*message, *message_to_send)) { LOG4CXX_WARN(logger_, "Cannot send message to HMI: failed to create string"); return; } -#endif // WEB_HMI +#endif // HMI_JSON_API -#ifdef QT_HMI +#ifdef HMI_DBUS_API message_to_send->set_smart_object(*message); -#endif // QT_HMI +#endif // HMI_DBUS_API messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send)); } @@ -1396,16 +1397,16 @@ void ApplicationManagerImpl::ProcessMessageFromHMI( return; } -#ifdef WEB_HMI +#ifdef HMI_JSON_API if (!ConvertMessageToSO(*message, *smart_object)) { LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); return; } -#endif // WEB_HMI +#endif // HMI_JSON_API -#ifdef QT_HMI +#ifdef HMI_DBUS_API *smart_object = message->smart_object(); -#endif // QT_HMI +#endif // HMI_DBUS_API LOG4CXX_INFO(logger_, "Converted message, trying to create hmi command"); if (!ManageHMICommand(smart_object)) { @@ -1633,32 +1634,38 @@ void ApplicationManagerImpl::Unmute(VRTTSSessionChanging changing_state) { } mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( - const std::string& app_name, const std::vector<uint8_t>& binary_data, - const std::string& save_path, const uint32_t offset) { - if (binary_data.size() > file_system::GetAvailableSpaceForApp(app_name)) { + 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()) { + LOG4CXX_ERROR(logger_, "Out of free disc space."); return mobile_apis::Result::OUT_OF_MEMORY; } - LOG4CXX_INFO(logger_, "SaveBinaryWithOffset binary_size = " - << binary_data.size() << " offset = " << offset); - - uint32_t file_size = file_system::FileSize(file_system::FullPath(save_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 filesize"); + LOG4CXX_INFO( + logger_, + "ApplicationManagerImpl::SaveBinaryWithOffset offset does'n match existing filesize"); return mobile_apis::Result::INVALID_DATA; } - file_stream = file_system::Open(file_system::FullPath(save_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"); + LOG4CXX_INFO( + logger_, + "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite"); // if offset == 0: rewrite file - file_stream = file_system::Open(file_system::FullPath(save_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(), binary_data.size())) { + if (!file_system::Write(file_stream, binary_data.data(), + binary_data.size())) { file_system::Close(file_stream); return mobile_apis::Result::GENERIC_ERROR; } @@ -1667,4 +1674,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( return mobile_apis::Result::SUCCESS; } +bool ApplicationManagerImpl::IsHMICooperating() const { + return hmi_cooperating_; +} + } // namespace application_manager |