summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Byzhynar <abyzhynar@luxoft.com>2018-09-17 18:57:47 +0300
committerAndriy Byzhynar <abyzhynar@luxoft.com>2018-09-17 18:57:47 +0300
commit108e01480821ff0499e4622127e8253471681d48 (patch)
tree1c1eb4b398830d424831e035e1ced9e510c940f8
parent086779d41c56e0764f145bd6d79d25205e45e3f6 (diff)
downloadsdl_core-108e01480821ff0499e4622127e8253471681d48.tar.gz
Fixes after rebase
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc17
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc6
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc6
4 files changed, 96 insertions, 13 deletions
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index 59a1683755..8f98827a68 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -36,6 +36,7 @@
#include "application_manager/resumption/resume_ctrl.h"
#include <stdint.h>
+#include <time.h>
#include <vector>
#include <map>
#include <set>
@@ -132,6 +133,10 @@ class ResumeCtrlImpl : public ResumeCtrl {
*/
void OnAwake() OVERRIDE;
+ void SaveLowVoltageTime() OVERRIDE;
+
+ void SaveWakeUpTime() OVERRIDE;
+
/**
* @brief Checks if SDL has already received OnExitAllApplication notification
* with "SUSPEND" reason
@@ -149,6 +154,13 @@ class ResumeCtrlImpl : public ResumeCtrl {
void StopSavePersistentDataTimer() OVERRIDE;
/**
+ * @brief Check if all IGNITION OFF and IGNITION ON records
+ * saved in resumption data base
+ * @return True if all records saved, otherwise False
+ */
+ bool CheckIgnCyclesData() const;
+
+ /**
* @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in OnSuspend()
*/
void StopRestoreHmiLevelTimer();
@@ -307,6 +319,20 @@ class ResumeCtrlImpl : public ResumeCtrl {
#endif // BUILD_TESTS
private:
/**
+ * @brief Returns Low Voltage signal timestamp
+ * @return Low Voltage event timestamp if event LOW VOLTAGE event occures
+ * otherwise 0
+ */
+ time_t LowVoltageTime() const;
+
+ /**
+ * @brief Returns Wake Up signal timestamp
+ * @return Wake Up timestamp if Wake Up signal occures
+ * otherwise 0
+ */
+ time_t WakeUpTime() const;
+
+ /**
* @brief restores saved data of application
* @param application contains application for which restores data
* @return true if success, otherwise return false
@@ -332,6 +358,19 @@ class ResumeCtrlImpl : public ResumeCtrl {
bool DisconnectedJustBeforeIgnOff(
const smart_objects::SmartObject& saved_app);
+ /**
+ * @brief Checks if saved HMI level is allowed for resumption
+ * by Low Voltage restrictions
+ * @param saved_app application specific section from backup file
+ * @return True if allowed , otherwise - False
+ */
+ bool CheckLowVoltageRestrictions(const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief Checks if saved HMI level is applicable for resumption
+ * @param saved_app application specific section from backup file
+ * @return True fs allowed , otherwise - False
+ */
bool CheckAppRestrictions(app_mngr::ApplicationConstSharedPtr application,
const smart_objects::SmartObject& saved_app);
@@ -345,11 +384,39 @@ class ResumeCtrlImpl : public ResumeCtrl {
smart_objects::SmartObject& obj);
/**
- * @brief CheckDelayAfterIgnOn should check if SDL was started less
- * then N seconds ago. N will be readed from profile.
- * @return true if SDL started N seconds ago, otherwise return false
+ * @brief CheckDelayAfterIgnOn should check if SDL was started less
+ * than N seconds ago. N will be read from profile.
+ * @return true if SDL started N seconds ago, otherwise return false
+ */
+ bool CheckDelayAfterIgnOn() const;
+
+ /**
+ * @brief CheckDelayBeforeIgnOff checks if app was unregistered less
+ * than N seconds before Ignition OFF. N will be read from profile.
+ * @return true if app was disconnected within timeframe of N seconds before
+ * Ignition Off,
+ * otherwise return false
+ */
+ bool CheckDelayBeforeIgnOff(
+ const smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief CheckDelayAfterWakeUp should check if app was registered
+ * during the first N seconds after WakeUp signal. N will be read from
+ * profile.
+ * @return true if app registered within N seconds after WakeUp, otherwise
+ * return false
+ */
+ bool CheckDelayAfterWakeUp() const;
+
+ /**
+ * @brief CheckDelayBeforeLowVoltage checks if app was unregistered within
+ * N seconds before Low Voltage signal. N will be read from profile.
+ * @return true if app was disconnected within timeframe of N seconds before
+ * Low Voltage , otherwise return false
*/
- bool CheckDelayAfterIgnOn();
+ bool CheckDelayBeforeLowVoltage(
+ const smart_objects::SmartObject& saved_app) const;
typedef std::pair<uint32_t, uint32_t> application_timestamp;
@@ -384,7 +451,7 @@ class ResumeCtrlImpl : public ResumeCtrl {
* @brief Get the last ignition off time from LastState
* @return the last ignition off time from LastState
*/
- time_t GetIgnOffTime();
+ time_t GetIgnOffTime() const;
/**
* @brief Setup IgnOff time to LastState
@@ -457,8 +524,11 @@ class ResumeCtrlImpl : public ResumeCtrl {
bool is_data_saved_;
bool is_suspended_;
time_t launch_time_;
+ time_t low_voltage_time_;
+ time_t wake_up_time_;
std::shared_ptr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
+ ResumptionDataProcessor resumption_data_processor_;
};
} // namespace resumption
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 9b0dfd8a96..b66d737648 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -473,7 +473,7 @@ void RegisterAppInterfaceRequest::Run() {
const std::string app_id_short = msg_params[strings::app_id].asString();
std::string new_app_id_short = app_id_short;
std::transform(app_id_short.begin(),
- app_id_short.en
+ app_id_short.end(),
new_app_id_short.begin(),
::tolower);
(*message_)[strings::msg_params][strings::app_id] = new_app_id_short;
@@ -487,7 +487,7 @@ void RegisterAppInterfaceRequest::Run() {
::tolower);
(*message_)[strings::msg_params][strings::full_app_id] = new_app_id_full;
}
-
+
if (IsApplicationForbidden()) {
LOG4CXX_WARN(logger_, "Application is Forbidden ");
SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS);
@@ -529,6 +529,16 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
+ uint16_t major =
+ msg_params[strings::sync_msg_version][strings::major_version].asUInt();
+ uint16_t minor =
+ msg_params[strings::sync_msg_version][strings::minor_version].asUInt();
+ uint16_t patch = 0;
+ // Check if patch exists since it is not mandatory.
+ if (msg_params[strings::sync_msg_version].keyExists(strings::patch_version)) {
+ patch =
+ msg_params[strings::sync_msg_version][strings::patch_version].asUInt();
+ }
utils::SemanticVersion mobile_version(major, minor, patch);
utils::SemanticVersion min_module_version(
@@ -795,6 +805,9 @@ void FinishSendingRegisterAppInterfaceToMobile(
resumption::ResumeCtrl& resume_ctrl = app_manager.resume_controller();
auto application = app_manager.application(connection_key);
+ policy::PolicyHandlerInterface& policy_handler =
+ app_manager.GetPolicyHandler();
+
if (msg_params.keyExists(strings::app_hmi_type)) {
policy_handler.SetDefaultHmiTypes(application->policy_app_id(),
&(msg_params[strings::app_hmi_type]));
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 6ae14279e7..81a8d7a9ef 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -2396,11 +2396,12 @@ void ApplicationManagerImpl::UnregisterApplication(
subscribed_for_way_points_app_count =
subscribed_way_points_apps_list_.size();
}
+ ApplicationSharedPtr app_ptr = application(app_id);
if (1 == subscribed_for_way_points_app_count) {
LOG4CXX_DEBUG(logger_, "Send UnsubscribeWayPoints");
if (!is_resuming) {
LOG4CXX_DEBUG(logger_, "Unsubscribe App from WayPoints");
- UnsubscribeAppFromWayPoints(app_id);
+ UnsubscribeAppFromWayPoints(app_ptr);
}
MessageHelper::SendUnsubscribedWayPoints(*this);
}
@@ -2429,7 +2430,6 @@ void ApplicationManagerImpl::UnregisterApplication(
case mobile_apis::Result::EXPIRED_CERT:
break;
case mobile_apis::Result::TOO_MANY_PENDING_REQUESTS: {
- ApplicationSharedPtr app_ptr = application(app_id);
if (app_ptr) {
app_ptr->usage_report().RecordRemovalsForBadBehavior();
if (reason == mobile_apis::Result::TOO_MANY_PENDING_REQUESTS) {
@@ -2473,7 +2473,7 @@ void ApplicationManagerImpl::UnregisterApplication(
if (is_resuming) {
resume_controller().SaveApplication(app_to_remove);
- UnsubscribeAppFromWayPoints(app_id);
+ UnsubscribeAppFromWayPoints(app_ptr);
} else {
resume_controller().RemoveApplicationFromSaved(app_to_remove);
}
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index edc0e77aa8..0bd9f60323 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -76,7 +76,7 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
, launch_time_(time(nullptr))
, low_voltage_time_(0)
, wake_up_time_(0)
- , application_manager_(application_manager)
+ , application_manager_(application_manager)
, resumption_data_processor_(application_manager) {}
#ifdef BUILD_TESTS
void ResumeCtrlImpl::set_resumption_storage(
@@ -352,7 +352,7 @@ void ResumeCtrlImpl::SaveLowVoltageTime() {
}
void ResumeCtrlImpl::SaveWakeUpTime() {
- wake_up_time_ = std::time(nullptr);
+ wake_up_time_ = time(nullptr);
LOG4CXX_DEBUG(logger_, "Wake Up timestamp : " << wake_up_time_ << " saved");
}
@@ -650,7 +650,7 @@ bool ResumeCtrlImpl::CheckLowVoltageRestrictions(
return true;
}
-bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
+bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
const smart_objects::SmartObject& saved_app) const {
using namespace date_time;
LOG4CXX_AUTO_TRACE(logger_);