summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h11
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc3
-rw-r--r--src/components/application_manager/src/system_time/system_time_handler_impl.cc16
4 files changed, 23 insertions, 16 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index d3fe69efcb..af096aa354 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -958,12 +958,11 @@ class ApplicationManagerImpl
security_manager::SSLContext::HandshakeResult result) OVERRIDE;
/**
- * @brief OnHandshakeFailed currently does nothing.
- * This method is declared as pure virtual in common base class
- * therefore it has to be present and should be implemented
- * to allow creation of current class instances
+ * @brief Notification about handshake failure
+ * @return true on success notification handling or false otherwise
*/
- void OnHandshakeFailed() OVERRIDE;
+ bool OnHandshakeFailed() OVERRIDE;
+
/**
* @brief Notification that certificate update is required.
*/
diff --git a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
index 28ba629e19..add440ad80 100644
--- a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
+++ b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
@@ -140,10 +140,13 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler,
mutable sync_primitives::Lock state_lock_;
// Variable means HMI readiness to provide system time by request
volatile bool utc_time_can_be_received_;
- // Varible used to schedule next GetSystemTime request
- // if at the moment of sending first GetSystemTime request
- // HMI is not ready to provide system time
- volatile bool schedule_request_;
+
+ /**
+ * @brief Flag used to control that only GetSystemTime request at time could
+ * be sent to HMI
+ */
+ volatile bool awaiting_get_system_time_;
+
// Varible used to store result for GetSystemTime request
time_t last_time_;
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 5aa72d77e5..8d372f4fd2 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -1691,8 +1691,9 @@ bool ApplicationManagerImpl::OnHandshakeDone(
return false;
}
-void ApplicationManagerImpl::OnHandshakeFailed() {
+bool ApplicationManagerImpl::OnHandshakeFailed() {
LOG4CXX_AUTO_TRACE(logger_);
+ return false;
}
void ApplicationManagerImpl::OnCertificateUpdateRequired() {
diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
index a91fb16197..6ae6d3e901 100644
--- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc
+++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
@@ -45,7 +45,7 @@ SystemTimeHandlerImpl::SystemTimeHandlerImpl(
ApplicationManager& application_manager)
: event_engine::EventObserver(application_manager.event_dispatcher())
, utc_time_can_be_received_(false)
- , schedule_request_(false)
+ , awaiting_get_system_time_(false)
, system_time_listener_(NULL)
, app_manager_(application_manager) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -67,7 +67,6 @@ void SystemTimeHandlerImpl::DoSystemTimeQuery() {
LOG4CXX_INFO(logger_,
"Navi module is not yet ready."
<< "Will process request once it became ready.");
- schedule_request_ = true;
return;
}
SendTimeRequest();
@@ -99,11 +98,18 @@ bool SystemTimeHandlerImpl::utc_time_can_be_received() const {
void SystemTimeHandlerImpl::SendTimeRequest() {
LOG4CXX_AUTO_TRACE(logger_);
+
+ if (awaiting_get_system_time_) {
+ LOG4CXX_WARN(logger_, "Another GetSystemTime request in progress. Skipped");
+ return;
+ }
+
using namespace application_manager;
uint32_t correlation_id = app_manager_.GetNextHMICorrelationID();
subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_GetSystemTime,
correlation_id);
MessageHelper::SendGetSystemTimeRequest(correlation_id, app_manager_);
+ awaiting_get_system_time_ = true;
}
void SystemTimeHandlerImpl::on_event(
@@ -128,10 +134,6 @@ void SystemTimeHandlerImpl::ProcessSystemTimeReadyNotification() {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(state_lock_);
utc_time_can_be_received_ = true;
- if (schedule_request_) {
- SendTimeRequest();
- schedule_request_ = false;
- }
unsubscribe_from_event(
hmi_apis::FunctionID::BasicCommunication_OnSystemTimeReady);
}
@@ -164,6 +166,8 @@ void SystemTimeHandlerImpl::ProcessSystemTimeResponse(
if (system_time_listener_) {
system_time_listener_->OnSystemTimeArrived(last_time_);
}
+ sync_primitives::AutoLock state_lock(state_lock_);
+ awaiting_get_system_time_ = false;
}
} // namespace application_manager