diff options
10 files changed, 78 insertions, 67 deletions
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index debcfe66c2..84b2c847bd 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -45,6 +45,7 @@ cmake_policy(POP) if (EXTENDED_MEDIA_MODE) set(default_media_inc ${GSTREAMER_gst_INCLUDE_DIR} +${GSTREAMER_gstconfig_INCLUDE_DIR} ) else(EXTENDED_MEDIA_MODE) set(default_media_inc diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h index 49fa2a7608..479ebb217e 100644 --- a/src/components/application_manager/include/application_manager/request_controller.h +++ b/src/components/application_manager/include/application_manager/request_controller.h @@ -216,15 +216,14 @@ class RequestController { protected: /** - * @brief Timer Callback + * @brief Timer callback which handles all request timeouts */ - void onTimer(); + void TimeoutThread(); /** - * @brief Update timout for next OnTimer - * Not thread safe + * @brief Signal timer condition variable */ - void UpdateTimer(); + void NotifyTimer(); void terminateWaitingForExecutionAppRequests(const uint32_t& app_id); void terminateWaitingForResponseAppRequests(const uint32_t& app_id); @@ -284,6 +283,13 @@ class RequestController { */ timer::Timer timer_; + /* + * Timer for lock + */ + bool timer_stop_flag_; + sync_primitives::Lock timer_lock; + sync_primitives::ConditionalVariable timer_condition_; + bool is_low_voltage_; const RequestControlerSettings& settings_; DISALLOW_COPY_AND_ASSIGN(RequestController); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 1ef6e5ceb8..97dcce10bf 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1418,16 +1418,6 @@ void ApplicationManagerImpl::SendMessageToMobile( << ") not allowed by policy"); return; } - - if (function_id == mobile_apis::FunctionID::OnSystemRequestID) { - mobile_apis::RequestType::eType request_type = - static_cast<mobile_apis::RequestType::eType>( - (*message)[strings::msg_params][strings::request_type].asUInt()); - if (mobile_apis::RequestType::PROPRIETARY == request_type || - mobile_apis::RequestType::HTTP == request_type) { - GetPolicyHandler().OnUpdateRequestSentToMobile(); - } - } } if (message_to_send->binary_data()) { diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc index fdf8b559bc..fdf8b559bc 100644..100755 --- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index cf312acc6d..23f5227667 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1130,6 +1130,8 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string) { } SendMessageToSDK(pt_string, urls.front().url.front()); #endif + // reset update required false + OnUpdateRequestSentToMobile(); } bool PolicyHandler::GetPriority(const std::string& policy_app_id, diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index cdf1616e42..aa2a3d7c5d 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -51,15 +51,20 @@ RequestController::RequestController(const RequestControlerSettings& settings) , pool_size_(settings.thread_pool_size()) , timer_("AM RequestCtrlTimer", new timer::TimerTaskImpl<RequestController>( - this, &RequestController::onTimer)) + this, &RequestController::TimeoutThread)) + , timer_stop_flag_(false) , is_low_voltage_(false) , settings_(settings) { LOG4CXX_AUTO_TRACE(logger_); InitializeThreadpool(); + timer_.Start(0, timer::kSingleShot); } RequestController::~RequestController() { LOG4CXX_AUTO_TRACE(logger_); + timer_stop_flag_ = true; + timer_condition_.Broadcast(); + timer_.Stop(); if (pool_state_ != TPoolState::STOPPED) { DestroyThreadpool(); } @@ -202,7 +207,7 @@ RequestController::TResult RequestController::addHMIRequest( LOG4CXX_DEBUG(logger_, "Waiting for response count:" << waiting_for_response_.Size()); - UpdateTimer(); + NotifyTimer(); return RequestController::SUCCESS; } @@ -252,7 +257,7 @@ void RequestController::TerminateRequest(const uint32_t correlation_id, } else { LOG4CXX_WARN(logger_, "Request was not terminated"); } - UpdateTimer(); + NotifyTimer(); } void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id, @@ -307,7 +312,7 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) { terminateWaitingForExecutionAppRequests(app_id); terminateWaitingForResponseAppRequests(app_id); - UpdateTimer(); + NotifyTimer(); } void RequestController::terminateAllHMIRequests() { @@ -322,7 +327,7 @@ void RequestController::terminateAllMobileRequests() { AutoLock waiting_execution_auto_lock(mobile_request_list_lock_); mobile_request_list_.clear(); LOG4CXX_DEBUG(logger_, "Mobile Requests waiting for execution cleared"); - UpdateTimer(); + NotifyTimer(); } void RequestController::updateRequestTimeout(const uint32_t& app_id, @@ -344,7 +349,7 @@ void RequestController::updateRequestTimeout(const uint32_t& app_id, waiting_for_response_.RemoveRequest(request_info); request_info->updateTimeOut(new_timeout); waiting_for_response_.Add(request_info); - UpdateTimer(); + NotifyTimer(); LOG4CXX_INFO(logger_, "Timeout updated for " << " app_id: " << app_id << " correlation_id: " @@ -375,14 +380,40 @@ bool RequestController::IsLowVoltage() { return is_low_voltage_; } -void RequestController::onTimer() { +void RequestController::TimeoutThread() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG( logger_, "ENTER Waiting fore response count: " << waiting_for_response_.Size()); - RequestInfoPtr probably_expired = - waiting_for_response_.FrontWithNotNullTimeout(); - while (probably_expired && probably_expired->isExpired()) { + while (!timer_stop_flag_) { + RequestInfoPtr probably_expired = + waiting_for_response_.FrontWithNotNullTimeout(); + if (!probably_expired) { + sync_primitives::AutoLock auto_lock(timer_lock); + timer_condition_.Wait(auto_lock); + continue; + } + if (!probably_expired->isExpired()) { + LOG4CXX_DEBUG(logger_, + "Timeout for " + << (RequestInfo::HMIRequest == + probably_expired->requst_type() + ? "HMI" + : "Mobile") + << " request id: " << probably_expired->requestId() + << " connection_key: " << probably_expired->app_id() + << " NOT expired"); + sync_primitives::AutoLock auto_lock(timer_lock); + const TimevalStruct current_time = date_time::DateTime::getCurrentTime(); + const TimevalStruct end_time = probably_expired->end_time(); + if (current_time < end_time) { + const uint32_t msecs = static_cast<uint32_t>( + date_time::DateTime::getmSecs(end_time - current_time)); + LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs"); + timer_condition_.WaitFor(auto_lock, msecs); + } + continue; + } LOG4CXX_INFO(logger_, "Timeout for " << (RequestInfo::HMIRequest == @@ -410,7 +441,6 @@ void RequestController::onTimer() { } } } - UpdateTimer(); LOG4CXX_DEBUG( logger_, "EXIT Waiting for response count : " << waiting_for_response_.Size()); @@ -461,7 +491,7 @@ void RequestController::Worker::threadMain() { LOG4CXX_DEBUG(logger_, "timeout_in_mseconds " << timeout_in_mseconds); if (0 != timeout_in_mseconds) { - request_controller_->UpdateTimer(); + request_controller_->NotifyTimer(); } else { LOG4CXX_DEBUG(logger_, "Default timeout was set to 0. " @@ -489,37 +519,9 @@ void RequestController::Worker::exitThreadMain() { // FIXME (dchmerev@luxoft.com): There is no waiting } -void RequestController::UpdateTimer() { +void RequestController::NotifyTimer() { LOG4CXX_AUTO_TRACE(logger_); - RequestInfoPtr front = waiting_for_response_.FrontWithNotNullTimeout(); - // Buffer for sending request - const uint32_t delay_time = 100u; - if (front) { - const TimevalStruct current_time = date_time::DateTime::getCurrentTime(); - TimevalStruct end_time = front->end_time(); - date_time::DateTime::AddMilliseconds(end_time, delay_time); - if (current_time < end_time) { - const uint32_t msecs = static_cast<uint32_t>( - date_time::DateTime::getmSecs(end_time - current_time)); - LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs"); - // Timeout for bigger than 5 minutes is a mistake - timer_.Start(msecs, timer::kSingleShot); - } else { - LOG4CXX_WARN( - logger_, - "Request app_id: " - << front->app_id() << " correlation_id: " << front->requestId() - << " is expired. " - << "End time (ms): " << date_time::DateTime::getmSecs(end_time) - << " Current time (ms): " - << date_time::DateTime::getmSecs(current_time) - << " Diff (current - end) (ms): " - << date_time::DateTime::getmSecs(current_time - end_time) - << " Request timeout (sec): " - << front->timeout_msec() / - date_time::DateTime::MILLISECONDS_IN_SECOND); - } - } + timer_condition_.NotifyOne(); } } // namespace request_controller diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index f24c8812b4..022053f96a 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -243,10 +243,10 @@ </enum> <struct name="Coordinate"> - <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Double" mandatory="true"> + <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Float" mandatory="true"> <description>Latitude of the location.</description> </param> - <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Double" mandatory="true"> + <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Float" mandatory="true"> <description>Longitude of the location.</description> </param> </struct> @@ -1680,9 +1680,9 @@ <!--IVI part--> <struct name="GPSData"> <description>Struct with the GPS data.</description> - <param name="longitudeDegrees" type="Double" minvalue="-180" maxvalue="180" mandatory="false"> + <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false"> </param> - <param name="latitudeDegrees" type="Double" minvalue="-90" maxvalue="90" mandatory="false"> + <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="false"> </param> <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="false"> <description>The current UTC year.</description> diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index bc47d1e6d7..d0326ce647 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -2311,10 +2311,10 @@ </enum>
<struct name="Coordinate">
- <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Double" mandatory="true">
+ <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Float" mandatory="true">
<description>Latitude of the location.</description>
</param>
- <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Double" mandatory="true">
+ <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Float" mandatory="true">
<description>Longitude of the location.</description>
</param>
</struct>
@@ -4815,9 +4815,9 @@ </function>
<function name="SendLocation" functionID="SendLocationID" messagetype="request">
- <param name="longitudeDegrees" type="Double" minvalue="-180" maxvalue="180" mandatory="false">
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
</param>
- <param name="latitudeDegrees" type="Double" minvalue="-90" maxvalue="90" mandatory="false">
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="false">
</param>
<param name="locationName" type="String" maxlength="500" mandatory="false">
<description>
diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt index 69af6e7841..3ca02357ab 100644 --- a/src/components/media_manager/CMakeLists.txt +++ b/src/components/media_manager/CMakeLists.txt @@ -37,6 +37,7 @@ pkg_check_modules(GLIB2 REQUIRED glib-2.0) add_definitions(${GLIB2_CFLAGS}) set(default_includes ${GSTREAMER_gst_INCLUDE_DIR} + ${GSTREAMER_gstconfig_INCLUDE_DIR} ${GLIB_glib_2_INCLUDE_DIR} ) set(default_sources @@ -63,6 +64,8 @@ set(LIBRARIES glib-2.0 ) else(EXTENDED_MEDIA_MODE) +set(default_includes +) set(default_sources ${COMPONENTS_DIR}/media_manager/src/audio/socket_audio_streamer_adapter.cc @@ -96,6 +99,7 @@ include_directories ( ${JSONCPP_INCLUDE_DIRECTORY} ${CMAKE_BINARY_DIR}/src/components/ ${COMPONENTS_DIR}/policy/include/ + ${default_includes} ${LOG4CXX_INCLUDE_DIRECTORY} ) diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index e531894b27..b89fc4c71f 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -114,8 +114,6 @@ void MediaManagerImpl::Init() { #if defined(EXTENDED_MEDIA_MODE) LOG4CXX_INFO(logger_, "Called Init with default configuration."); - a2dp_player_ = - new A2DPSourcePlayerAdapter(protocol_handler_->get_session_observer()); from_mic_recorder_ = new FromMicRecorderAdapter(); #endif @@ -157,6 +155,14 @@ void MediaManagerImpl::Init() { void MediaManagerImpl::PlayA2DPSource(int32_t application_key) { LOG4CXX_AUTO_TRACE(logger_); + +#if defined(EXTENDED_MEDIA_MODE) + if (!a2dp_player_ && protocol_handler_) { + a2dp_player_ = + new A2DPSourcePlayerAdapter(protocol_handler_->get_session_observer()); + } +#endif + if (a2dp_player_) { a2dp_player_->StartActivity(application_key); } |